Skip to content

Route model binding supported? #717

Answered by mjauvin
ericp-mrel asked this question in Q&A
Discussion options

You must be logged in to vote

@ericp-mrel I found the issue... in order for the implicit model binding to work, you need to use the "web" group middleware in your route:

Route::get('/pdf/acme/{foo}/details', function (Foo $foo) {
    // ...
})->middleware('web');

Alternatively, you can use the \Illuminate\Routing\Middleware\SubstituteBindings middleware directly:

Route::get('/pdf/acme/{foo}/details', function (Foo $foo) {
    // ...
})->middleware('\Illuminate\Routing\Middleware\SubstituteBindings');

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@ericp-mrel
Comment options

Answer selected by mjauvin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants