Route model binding supported? #717
-
Hi, I'm trying to use route model binding according to the Laravel documentation, but it is not working no matter what I do. https://laravel.com/docs/9.x/routing#customizing-the-key I've tried doing something like this: Route::get('/pdf/acme/{foo}/details', function (Foo $foo) {
// ...
}); and Route::get('/pdf/acme/{foo:slug}/details', function (Foo $foo) {
// ...
}); Just wondering if this is supported by Winter CMS? I assume it should be since this is just standard Laravel routing. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
We definitely don't override much with the Routing side of things, but I believe we do handle dependency injection a little differently, which might be why this is not working. I'll convert this to an issue. (#718) |
Beta Was this translation helpful? Give feedback.
-
@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:
Alternatively, you can use the
|
Beta Was this translation helpful? Give feedback.
@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:
Alternatively, you can use the
\Illuminate\Routing\Middleware\SubstituteBindings
middleware directly: