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

ChaoZz's avatar

Laravel 5 | User Groups, How can i make it

Hey Guys, first of all i want to say that I am new to laravel and just know the basics like routing, model, eloquent etc. Something like providers is unknown for me. I wanted to build groups with permissions so that i can grant access to the admin control panel to the group which got the permission for it(for example). But i dont know where i have to load the groups and where i have to put everthing. I already got 3 tables in my database(created with artisan via make:migration), one groups table, which is for basic stuff like group name, description and of course increments. the second one lists all permission. the third connects permissions and groups and give them a value(for example group id: 1, perm id: 1, value: true) well and now my problem is that i dont know how i can load these groups into my aplication and load the permissions for the groups.

I hope my english is understandable.

0 likes
5 replies
ChaoZz's avatar

I will look at it and give an answer later. :) Thank u for your answer

ChaoZz's avatar

I think it is the right way i just have problems to actually make the hole thing.

I got the three tables: mop_group:

  • id
  • name
  • description

mop_group_option:

  • id
  • name
  • type (boolean etc.)
  • default

mop_group_option_value:

  • group_id
  • option_id
  • optionValue

Maybe now can someone help me out :/

ChaoZz's avatar

So i have to put in model (just basic) belongsTo('App\Group', 'mop_group', 'groupID') and in Group model i have to put belongsToMany('App\GroupPermission', 'mop_group_option_value', 'groupID', 'optionID')?

Am i right or am i doing it wrong?

Please or to participate in this conversation.