Support the ongoing development of Laravel.io →
posted 2 weeks ago
Laravel
0

Right now if laravel does that, it wouldn't help much since laravel terminates the request if it fails at middleware level. I mean it does not fallthrough to a different route. Additionally its best that each route is self documenting and unique per endpoint otherwise you'll have bugs to deal with on the long run.

Perhaps the issue you're facing can be solved another way and would be:

  • /admin/users
  • /commissioner/users

The benefit for above is

  • better documentation
  • Isolated functionality
  • Easy to apply middlewares strictly to each route

Or

  • /all/users (UsersController)

And then in the controller you can make a check to see if its admin. I would definitely recommend the first one unless you must do it this way.

Last updated by @omitobi 1 week ago.

hdyadav liked this reply

1

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.