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?
2
Answers
Based what error says, it expects parameter name as
foo
. So yon can modify your key name to match parameter name.Or modify your Route parameter name to match the key in link.
This should work aswell as long as $foo contains a variable baz_param: