I have multiple users with multiple permission (admin and user). example: admin is able to see sidebar a,b,c but user can only see sidebar d,e,f.
Can you load the menu at adminlte.php based on the permission? I store the permission in permission column inside User table (isAdmin, isUser) Thank you
Menu array format in adminlte.php:
'menu' => [ [ 'text' => 'Dashboard', 'url' => '/dashboard', 'icon' => 'dashboard', ], ],
The only solution that i found is for plain php http://seegatesite.com/how-to-create-user-permissions-view-to-dynamic-sidebar-menu-adminlte/
I would prefer a native laravel solution using the built in adminlte.php
Advertisement
Answer
I think using database is wise choice. But we could avoid using raw database query and use Laravel built-ins.
In sidebar.blade.php (or other template/view files you have), you could fetch permissions from database and then use them to show your specific menu like:
@if(Auth::user()->permission_1) <li><a href=""><i class="fa fa-group"></i> menu-item_1</a></li> @endif @if(Auth::user()->permission_2) <li><a href=""><i class="fa fa-tasks"></i> menu-item_2</a></li> @endif