mardi 11 août 2020

Show the index blade on 404 in laravel

I would like to show the index page if the route is not found.

I have modified the App\Exceptions\Handler like so and that did not work

public function render($request, Exception $exception)
{

    if ($this->isHttpException($exception) || $exception instanceof UnauthorizedException) {
        if ($exception->getStatusCode() == 404) {
            return view('app.index');
        }
    }

    return parent::render($request, $exception);
}


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire