Custom error page not showing on Laravel 5

前端 未结 6 805
旧时难觅i
旧时难觅i 2020-12-19 07:25

I am trying to display a custom error page instead of the default Laravel 5 message :

\"Whoops...looks like something went wrong\"

6条回答
  •  生来不讨喜
    2020-12-19 07:52

    Instead of the response create a route for your error page in your Routes.php, with the name 'errors.defaultError'. for example

    route::get('error', [
        'as' => 'errors.defaultError',
        'uses' => 'ErrorController@defaultError' ]);
    

    Either make a controller or include the function in the route with

    return view('errors.defaultError');
    

    and use a redirect instead. For example

    public function render($request, Exception $e)
    {
        return redirect()->route('errors.defaultError');
    }
    

提交回复
热议问题