Customized Laravel 5.1 default error page:
For customized Laravel 5.1 default error page, we have to modify following file.
By modification this file we can override this file :
<?php namespace App\Exceptions;
use Exception;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Symfony\Component\Debug\ExceptionHandler as SymfonyDisplayer;
class Handler extends ExceptionHandler
{
/**
* Convert the given exception into a Response instance.
*
* @param \Exception $e
*
* @return \Symfony\Component\HttpFoundation\Response
*/
protected function convertExceptionToResponse(Exception $e)
{
$debug = config('app.debug', false);
if ($debug) {
return (new SymfonyDisplayer($debug))->createResponse($e);
}
return response()->view('errors.default', ['expection' => $e], 500);
}
}
Due to doing this, we can easily modify this file :
which is exist here:
Thanks
For customized Laravel 5.1 default error page, we have to modify following file.
app/Exceptions/Handler.php
By modification this file we can override this file :
convertExceptionToResponse
<?php namespace App\Exceptions;
use Exception;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Symfony\Component\Debug\ExceptionHandler as SymfonyDisplayer;
class Handler extends ExceptionHandler
{
/**
* Convert the given exception into a Response instance.
*
* @param \Exception $e
*
* @return \Symfony\Component\HttpFoundation\Response
*/
protected function convertExceptionToResponse(Exception $e)
{
$debug = config('app.debug', false);
if ($debug) {
return (new SymfonyDisplayer($debug))->createResponse($e);
}
return response()->view('errors.default', ['expection' => $e], 500);
}
}
Due to doing this, we can easily modify this file :
errors.default
which is exist here:
resources/view/errors
Thanks
No comments:
Post a Comment