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

iamcavic's avatar

Looking to implement permission / roles to my project

Project I'm working on requires some roles nothing too complex roughly 5-6 different roles based on title (Members, Staff, Admin, Editor, Financier) should I just crate a table with available rolls and join them? There might be a scenario where user can have multiple roles.

Would that be best way to do this?

I would like to access these properties in few places eg. Routes file if->auth->hasRole(editor)

  • access these routes

In controller similar thing user->hasRole

  • can use this function

Would like your guys' feedback and suggested implementation Thanks

0 likes
6 replies
jlrdw's avatar

I would still suggest viewing the laracasts videos on authorization because spatie uses the inbuilt authorization.

This will give you a much better understanding of exactly how it all works together.

1 like
vincent15000's avatar

I have set roles in one of my apps without any package and it works fine.

I have created a roles table.

Then for each user I have a json field to save the different roles assigned to this user.

Then I define the policies to check the authorizations.

Please or to participate in this conversation.