Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Route Model Bidding + Route Multi-Segments #49

Closed
devajmeireles opened this issue Jul 26, 2023 · 2 comments
Closed

Route Model Bidding + Route Multi-Segments #49

devajmeireles opened this issue Jul 26, 2023 · 2 comments
Assignees

Comments

@devajmeireles
Copy link

devajmeireles commented Jul 26, 2023

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:

CleanShot 2023-07-26 at 3 03 24

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

  1. Prepare your application, including seeding the database with fake users
  2. Install Folio and prepare them to be used
  3. Run make:folio "profiles/[...ids]"
  4. Run make:folio "profiles/[User]"
  5. Try to access the profiles/1 and check that [...ids] will works instead of [User]
@discoverlance-com
Copy link

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.

@taylorotwell
Copy link
Member

Multi-segment routes take precedence.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants