Route Model Bidding + Route Multi-Segments
devajmeireles opened this issue · comments
Folio Version
1.0.0
Laravel Version
Latest
PHP Version
8.1.21
Description
What
I don't know if an update to README.md
(docs) is enough or if the Laravel team wants to do something about it, but the multi-parameter route system eliminates Route Model Bidding:
Something like this:
When accessing profiles/1
in the browser, [...ids].blade.php
have priority over [User].blade.php
, even [User].blade.php
was created after. Perhaps the Laravel team knows about this and is aware, but here's my suggestion 👇
Suggestion
Adapting make:folio
:
The make:folio
command can intercept this situation and give a visual feedback to the dev.
Throw An Exception
The access of a route that contains a trying to use Route Model Bidding together of Route Multi-Segments can simple try and exception providing a feedback to the dev.
Hope this help,
Thanks.
Steps To Reproduce
- Prepare your application, including seeding the database with fake users
- Install Folio and prepare them to be used
- Run
make:folio "profiles/[...ids]"
- Run
make:folio "profiles/[User]"
- Try to access the
profiles/1
and check that[...ids]
will works instead of[User]
Perhaps the [User]
should have a higher priority and it should be possible to collocate both but definitely, User should have priority over multiple parameters.
Multi-segment routes take precedence.