Пример #1
0
 public function getRole($id)
 {
     $user = User::find($id);
     $role_user = RoleUser::where('user_id', $user->id)->first();
     $role_id = isset($role_user) ? $role_user->role_id : null;
     $roles = Role::all();
     $action = route('admin.users.role', array('user_id' => $id));
     return view('backend::users.role', compact('role_id', 'roles', 'action'));
 }
Пример #2
0
 public function savePermissions($id)
 {
     $role = Role::find($id);
     $inputs = Input::all();
     unset($inputs['_token']);
     $permission_ids = array_values($inputs);
     $role->perms()->sync($permission_ids);
     //        $message = array('result' => true,'content'=>'分配权限成功,重新登陆后即可更新左侧菜单栏');
     return 1;
 }