/** * 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')); }
/** * 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')); }
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; }