Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

dbassassin's avatar

Roles

Before I start trying to use any outside packages, I'm reading that middleware could be used for validating user roles? Is this is the preferred method moving forward with 5.1 or is there something else I should investigate. I'm really looking for things that are compatible with the changes introduced in 5.1

Thanks

0 likes
4 replies
mstnorris's avatar
Level 55

Third party permissions and roles packages use middleware. They just offer features that would take you a little work to do yourself. There isn't anything "special" about them so to speak. They still use the same technology that you're using. Just that they have written the code and you haven't. ;)

dbassassin's avatar

Thanks, your comment helped me to investigate things a little further. One of the things my brain wasn't connecting is the lack of a models folder in 5.0 and 5.1, yet most of the tutorials show a models folder (and pretty much all the examples of implementing roles). I just wanted to make sure I'm not going down a route (no pun intended) that will be or has been deprecated.

mstnorris's avatar

the model folder was removed in Laravel 5 as it was deemed unnecessary. So by elimination the videos you were watching were using Laravel 4.

I'm glad that helped you get started. If you have any questions going forward don't hesitate to give me a shout.

Please or to participate in this conversation.