Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

how send user to 404 page if not exist page in laravel

//step 1 ) create the errors/404.blade.php in view.

// step 2 ) go to Handler.php and replace the render function to belwo function.
  public function render($request, Throwable $exception)
    {
        if ($exception instanceof AccessDeniedHttpException) {
            return response(view('errors.404'), 404);
        }
        return parent::render($request, $exception);
    }
 
PREVIOUS NEXT
Tagged: #send #user #page #exist #page #laravel
ADD COMMENT
Topic
Name
6+6 =