coreui / coreui-free-laravel-admin-template

CoreUI Free Laravel Bootstrap Admin Template
https://coreui.io/laravel/
MIT License
628 stars 360 forks source link

Issue with menu roles. #48

Closed airliajsmith closed 3 years ago

airliajsmith commented 4 years ago

I have two roles for my account: Employee and Admin.

I can't see the menu elements that have only the role Employee. If I remove all roles from my account except Employee, I can see the menu. Why is that?

rakieta2015 commented 4 years ago

If you want a menu item to be visible for both roles, enter both roles into the menu item in MenuTableSeeder.php in this way: $this->insertLink('Admin,Employee', 'Cards', '/base/cards'); (In answer to the question: This is because the role of Admin is higher in the hierarchy than role Employee.)

airliajsmith commented 4 years ago

Sorry, I thought I had this figured out.

In the UsersSeeder, I entered the role 'order-entry into menuroles column. Then, I assign the role of 'order-entry' via the $user->assignRole('order-entry').

Then, in the MenusTableSeeder, I insert this:

  $this->beginDropdown('employee', 'Employee Links', 'cil-folder-open');

    $this->insertLink('order-entry', 'Sales Orders', '/salesorders');
    $this->insertLink('order-entry', 'Phone List', '/phonelist');
    $this->endDropdown();

However, when I login, I can't see the menu link I just inserted.

I am thinking about having our company purchase the pro version, but I need to get this figured out first.

Thanks.

rakieta2015 commented 4 years ago

The answer can be found here: https://community.coreui.io/t/menu-roles-and-roles/127