/** * 获取角色权限组和权限列表 * @param $role_id * @return mixed */ public static function getUserAuthList($role_id) { $authGroup = Role::with('roleGroup')->where('role_id', '=', $role_id)->first(); $authList = AuthGroupRelaionship::getAuthGroupRelationshipByGroupLabel($authGroup->roleGroup->group_label); $data['authGroup'] = $authGroup->roleGroup; $data['authList'] = $authList; return $data; }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { if ($result = check_auth_to('QXZ_EDIT')) { return $result; } $authObj = new Auth(); $data['authList'] = $authObj->getAuthList(); $data['authGroupInfo'] = AuthGroup::find($id); $data['selectAuth'] = AuthGroupRelaionship::getAuthGroupRelationshipByGroupLabel($id); foreach ($data['authList'] as &$item) { foreach ($item as &$val) { $val->selected = in_array($val->auth_label, $data['selectAuth']) ? true : false; } } return view('admin.auth_group.edit', $data); }