Exemple #1
0
 public function permission($role_id)
 {
     $role = Role::find($role_id);
     $menus = Menu::defaultOrder()->get();
     //->toTree()
     //查看角色拥有的菜单权限
     $has_menus = $role->menus;
     foreach ($menus as $k => $menu) {
         foreach ($has_menus as $m) {
             if ($menu->id == $m->id) {
                 $menus[$k]->can = 1;
             }
         }
     }
     $menus = $menus->toTree();
     return view($this->view_path . __FUNCTION__, compact('role', 'menus'));
 }
Exemple #2
0
 public function index()
 {
     $menus = Menu::defaultOrder()->get()->toTree();
     return view($this->view_path . __FUNCTION__, compact('menus'));
 }