how do I create custom error page in laravel 5
laravel-5, php
Solution
Thanks guys, Now it is working successfully,
I just change my app/Exceptions/Handler.php :
<?php
namespace App\Exceptions;
use Exception;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
class Handler extends ExceptionHandler {
protected $dontReport = [
'Symfony\Component\HttpKernel\Exception\HttpException'
];
public function report(Exception $e)
{
return parent::report($e);
}
public function render($request, Exception $e)
{
if ($this->isHttpException($e)) {
return $this->renderHttpException($e);
} else {
return parent::render($request, $e);
}
}
}
and create a error view on : \resources\views\errors\404.blade.php
Problem
I want to show custom error page in my Laravel 5 app; for example any user type URL like `http://www.example.com/url123` (wrong) but `http://www.example.com/url` (right). Default error show as : Uh-oh, something went wrong! Error Code: 500 But instead I want to show my custom view How I can achieve that as illustrated in the pages referenced below: https://mattstauffer.co/blog/laravel-5.0-custom-error-pages#how-to https://laracasts.com/discuss/channels/general-discussion/how-do-i-create-a-custom-404-error-page My current `app/Exceptions/Handler.php`: ``` <?php namespace App\Exceptions; use Exception; use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; use symfony\http-kernel\Symfony\Component\HttpKernel\Exception\NotFoundHttpException; class Handler extends ExceptionHandler { protected $dontReport = [ 'Symfony\Component\HttpKernel\Exception\HttpException' ]; public function report(Exception $e) { return parent::report($e); } public function render($request, Exception $e) { if ($this->isHttpException($e)) { return $this->renderHttpException($e); } else if($e instanceof NotFoundHttpException) { return response()->view('missing', [], 404); } else { return parent::render($request, $e); } } } ``` And I've create a error view at `\resources\views\errors\404.blade.php` but `404.blade.php` still does not get loaded.