I am having this route setup on my laravel app which uses the FooController
which uses an __invoke
method
Route::get('/foos/{foo:baz_param}', FooController::class)->name('foos');
I am also having a link in my blade template which is this
<a href="{{ route('foos', ['baz_param' => $foo->baz_param]) }}">
{{ $foo->baz_param }}
</a>
however I am getting the following error on screen
Missing required parameter for [Route: foos] [URI: foos/{foo}] [Missing parameter: foo].
How can I fix this?
Based what error says, it expects parameter name as foo
. So yon can modify your key name to match parameter name.
<a href="{{ route('foos', ['foo' => $foo->baz_param]) }}">
Or modify your Route parameter name to match the key in link.
Route::get('/foos/{baz_param}', ...);