Open goodmuyis opened 4 years ago
The more important the role is, the higher it should be in the hierarchy. The guest role should be at the end of the hierarchy. For example:
$x = Role::create(['name' => 'siteadmin']);
RoleHierarchy::create([
'role_id' => $x->id,
'hierarchy' => 1,
]);
$x = Role::create(['name' => 'tutor']);
RoleHierarchy::create([
'role_id' => $x->id,
'hierarchy' => 2,
]);
$adminRole = Role::create(['name' => 'admin']);
RoleHierarchy::create([
'role_id' => $adminRole->id,
'hierarchy' => 3,
]);
$userRole = Role::create(['name' => 'user']);
RoleHierarchy::create([
'role_id' => $userRole->id,
'hierarchy' => 4,
]);
$guestRole = Role::create(['name' => 'guest']);
RoleHierarchy::create([
'role_id' => $guestRole->id,
'hierarchy' => 5,
]);
Using the code below, I was able to add a new user with new role in to the database. But the problem is the Menu is not visible or added to the sidebar for the users with additional role. everything is working for the default user and admin roles.
What am I missing here
Edit: I have looked into the MenusTableSeeder.php to adjust the menuroles string but the menu items are not visible if user string is not added, user is the lowest roles
There is also an instance where $this->insertLink('admin,siteadmin,tutor', 'Add a Class', '/classroom/add');