Skip to content

PHP code snippet – How send the incorrect url to the page not found in laravel?

In your resources/views/errors folder make sure you have
a 404.blade.php file and if that is not there then create it and put 
something in this file.
  
  
Sepending on your environment setup. FYI, 
in app\Exceptions\Handler.php file the handler
method handles/catches the errors. So check it, you may
customize it, for example:

  public function render($request, Exception $e)
    {
        // Customize it, extra code
        if ($e instanceof AccessDeniedHttpException) {
            return response(view('errors.403'), 403);
        }
        
        // The method has only this line by default
        return parent::render($request, $e);
    }
See also  PHP code snippet - How to pass bearer token in swagger in laravel?

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.