/** * Create a new redirect response. * * @param string $path * @param int $status * @param array $headers * @return \Illuminate\Http\RedirectResponse */ protected function createRedirect($path, $status, $headers) { $redirect = new RedirectResponse($path, $status, $headers); $redirect->setRequest($this->app->make('request')); $redirect->setSession($this->app->make('session.store')); return $redirect; }
/** * Handle an uncaught exception from the application. * * @param \Throwable $exception * @return void */ protected function handleException($exception) { if ($exception instanceof Error) { $exception = new FatalThrowableError($exception); } $handler = $this->app->make('Illuminate\\Contracts\\Debug\\ExceptionHandler'); $handler->report($exception); if ($this->app->runningInConsole()) { $handler->renderForConsole(new ConsoleOutput(), $exception); } else { $handler->render($this->app->make('request'), $exception)->send(); } }
/** * Get the context from the request. * * @return array */ public function getContext() { if (is_null($this->cachedContext)) { $request = $this->app->make('request'); $this->cachedContext = ['scheme' => $request->getScheme(), 'host' => $request->getHost(), 'port' => $request->getPort(), 'base' => $request->getBaseUrl()]; } return $this->cachedContext; }
/** * Handle the exception. * * @param \Illuminate\Http\Request $request * @param \Throwable $exception * @return \Illuminate\Http\Response */ protected function handleException(Request $request, $exception) { $handler = $this->app->make('Illuminate\\Contracts\\Debug\\ExceptionHandler'); if ($exception instanceof Error) { $exception = new FatalThrowableError($exception); } $handler->report($exception); return $handler->render($request, $exception); }