Does Filament change Laravel's default Route Model Binding?
My understanding of RMB from all the docs I've read is that the app() facade should be able to resolve the current Model, based on the URL parameters. This works within the scope of say, a Resource, but not within a custom class.
class TestSetup { protected function configureDto() { \Debugbar::alert(request()->getPathInfo()); $project = app(Project::class); \Debugbar::alert($project); // --- }}
class TestSetup { protected function configureDto() { \Debugbar::alert(request()->getPathInfo()); $project = app(Project::class); \Debugbar::alert($project); // --- }}
This logs the current route, with the correct ID in the correct path, e.g.
/company/2/projects/3
/company/2/projects/3
, however the $project value is a blank model - it is not resolving the ID in the path.
Is this because the routes Filament gets us to create use {record} (e.g.
'view' => Pages\ViewProject::route('/{record}')
'view' => Pages\ViewProject::route('/{record}')
instead of {project}, thus rendering it unable to resolve? I've tried renaming the {record} to {project}, only to have it immediately throw a raft of errors.
I'm really stuck with this one. By everything I've read, this stuff should just work, but it isn't. Is there some trick I'm missing? A trait my class needs to use? A setting on my Model? I don't know enough about how it works to know for sure, but it is beginning to feel like Filament is doing something tricky in the middle here with DI, and that trickiness is either undocumented / or I'm completely missing something obvious.