data('role') == null && auth()->user()->hasRole('admin')) { return true; } if($menu->data('permission') == null && $menu->data('role') == null) { return true; } if($menu->data('role') != null) { if(auth()->user()->hasAnyRole(explode(',', $menu->data('role')))) { return true; } } if($menu->data('permission') != null) { if(auth()->user()->can($menu->data('permission')) ) { return true; } } } return false; } public static function checkRolePermission($role,$permission){ try{ if($role->hasPermissionTo($permission)){ return true; } return false; }catch (Exception $e){ return false; } } public static function demoUserPermission(){ if(Auth::user()->hasRole('demo_admin')){ return true; }else{ return false; } } }