I have the following function in laravel 7:
public function create(Franchise $franchise = null)
{
...
}
And the route is as follows:
Route::get('series/create/{franchise?}', 'SerieController@create')->name('serie.create');
when I execute it with parameters for example page_name/series/create/1
it executes normally but when I execute without parameters page_name/series/create
I get an error 404 | Not Found
.
I also used dd()
at the beginning of the function and it keeps giving me the same error
I also did the same with index:
Route::get('series/{franchise?}', 'SerieController@index')->name('serie');
And there it executes me well with or without parameters Is there a route problem?
it seems you didn't add
/series/create
to your router. This is the reason why Laravel doesn't see this route and throws a 404 error. Add that route to your router file: