findById($user->admin_role); $root = $role->id == RoleModel::ROLE_ROOT ? 1 : 0; $authKey = $this->getAuthKey(); $authInfo = [ 'id' => $user->id, 'name' => $user->name, 'routes' => $role->routes, 'root' => $root, ]; $this->session->set($authKey, $authInfo); return $authInfo; } public function clearAuthInfo() { $authKey = $this->getAuthKey(); $this->session->remove($authKey); } public function getAuthInfo() { $authKey = $this->getAuthKey(); $authInfo = $this->session->get($authKey); return $authInfo ?: null; } public function getAuthKey() { return 'admin_auth_info'; } }