Skip to content

Instantly share code, notes, and snippets.

@Saberko
Created August 5, 2016 07:50
Show Gist options
  • Save Saberko/7232580f61409332d31e4b55471fb7f6 to your computer and use it in GitHub Desktop.
Save Saberko/7232580f61409332d31e4b55471fb7f6 to your computer and use it in GitHub Desktop.
laravel 5.0 error page redirect
/**
* Render the given HttpException.
* call 'abort(errcode)' in code
*
* @param \Symfony\Component\HttpKernel\Exception\HttpException $e
* @return \Symfony\Component\HttpFoundation\Response
*/
protected function renderHttpException(HttpException $e)
{
if (!config('app.debug') && view()->exists('errors.'.$e->getStatusCode()))
{
return response()->view('errors.'.$e->getStatusCode(), [], $e->getStatusCode());
}
else
{
return (new SymfonyDisplayer(config('app.debug')))->createResponse($e);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment