Answers for "redirect 404 in laravel"

PHP
0

redirect 404 in laravel

return abort(404, 'Page not found.');
return abort(403, 'Unauthorized action.');
"create a resources/views/errors/404.blade.php"
Posted by: Guest on November-16-2020
0

how to set 404 page in laravel

/**
 * Render an exception into an HTTP response.
 *
 * @param  \Illuminate\Http\Request  $request
 * @param  \Exception  $exception
 * @return \Illuminate\Http\Response
 */
public function render($request, Exception $exception)
{
    if ($this->isHttpException($exception)) {
        if ($exception->getStatusCode() == 404) {
            return response()->view('errors.' . '404', [], 404);
        }
    }
 
    return parent::render($request, $exception);
}
Posted by: Guest on March-03-2021

Browse Popular Code Answers by Language