Arquivo web.php da laravel
<?php
use App\Http\Controllers\SeriesController;
use Illuminate\Routing\Route as RoutingRoute;
use Illuminate\Support\Facades\Route;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::get('/', function () {
return view('welcome');
});
Route::get('/series', 'SeriesController@index')->name('listar_cursos');
Route::get('/series/adicionar', 'SeriesController@create')->name(
'form_criar_serie'
);
Route::post('/series/adicionar', 'SeriesController@store');
Route::delete('/series/{id}', 'SeriesController@destroy');
Arquivo index.blade da laravel
@extends('layout')
@section('header')
Minhas Series Favoritas
@endsection
@section('body')
@if(!empty($mensagem))
<div class="alert alert-success">
{{$mensagem}}
</div>
@endif
<a class="btn btn-primary mb-2" href="{{ route('form_criar_serie') }}">Adicionar</a>
<ul class="list-group ">
@foreach ($series as $serie)
<li class="list-group-item d-flex justify-content-between align-items-center">
{{$serie->nome}}
<form action="/series/{{$serie->id}}" method="post"
onsubmit="return confirm('Tem certeza que deseja remover{{addslashes ($serie->nome)}} ?')">
@csrf
@method('DELETE')
<button class="btn btn-danger btn-sm">
<i class="far fa-trash-alt"></i>
</button>
</form>
</li>
@endforeach
</ul>
@endsection
todo o codigo está rodando normal, porém quando troco o nome da route como o instrutor fez, dá erro
Route::get('/series/criar', 'SeriesController@create')->name(
'form_criar_serie'
);
aponta pra este erro
Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException
The POST method is not supported for this route. Supported methods: GET, HEAD, DELETE.
tendo que voltar para como estava para funcionar novamente