/** * elfinder. * * @param \Illuminate\Http\Request $request * * @return mixed */ public function elfinder(Request $request) { $token = null; if ($request->hasSession() === true) { $token = $request->session()->token(); } return $this->responseFactory->view('elfinder::elfinder', compact('token')); }
public function logout(Request $request) { if ($request->hasSession()) { // flush sessions Session::flush(); // delete cookies return json(trans('auth.logout.success'), 0)->withCookie(Cookie::forget('uid'))->withCookie(Cookie::forget('token')); } else { return json(trans('auth.logout.fail'), 1); } }
/** * rpc response. * * @param \Recca0120\Terminal\Kernel $kernel * @param \Illuminate\Http\Request $request * @param \Illuminate\Contracts\Response\Factory $responseFactory * * @return mixed */ public function endpoint(Kernel $kernel, Request $request, ResponseFactory $responseFactory) { if ($request->hasSession() === true) { $session = $request->session(); if ($session->isStarted() === true) { $session->save(); } } $command = $request->get('command'); $status = $kernel->call($command); return $responseFactory->json(['jsonrpc' => $request->get('jsonrpc'), 'id' => $request->get('id'), 'result' => $kernel->output(), 'error' => $status]); }
/** * Whether the request contains a Session object. * * This method does not give any information about the state of the session object, * like whether the session is started or not. It is just a way to check if this Request * is associated with a Session instance. * * @return bool true when the Request contains a Session object, false otherwise * @static */ public static function hasSession() { //Method inherited from \Symfony\Component\HttpFoundation\Request return \Illuminate\Http\Request::hasSession(); }
/** * Prepare the request by injecting any services. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Request */ public function prepareRequest(Request $request) { if (!is_null($this['config']['session.driver']) && !$request->hasSession()) { $request->setSession($this['session']->driver()); } return $request; }