예제 #1
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $user = $this->user->findOrFail($id);
     $sections = Section::get();
     $permissions = Permission::get();
     return view('acl::users.show', compact('user', 'sections', 'permissions'));
 }
예제 #2
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $role = Role::findOrFail($id);
     $sections = Section::get();
     $permissions = Permission::get();
     return view('acl::roles.show', compact('role', 'sections', 'permissions'));
 }
예제 #3
0
 public function detachPerm($section, $permission)
 {
     if (is_object($permission)) {
         $permission = $permission->getKey();
     } elseif (is_array($permission)) {
         $permission = $permission['id'];
     } elseif (is_string($permission)) {
         $permission = Permission::where('code', $permission)->first()->id;
     }
     if (is_object($section)) {
         $section = $section->getKey();
     } elseif (is_array($section)) {
         $section = $section['id'];
     } elseif (intval($permission) == 0) {
         $section = Section::where('code', $section)->first()->id;
     }
     if (!$permission || !$section) {
         return false;
     }
     $data = ['user_id' => $this->id, 'section_id' => $section, 'permission_id' => $permission];
     $permission = PermissionSectionUser::where($data);
     if ($permission->count() == 1) {
         $permission->delete();
         return true;
     }
     return false;
 }