Answer the question
In order to leave comments, you need to log in
How to disable Whoops error output in laravel?
Good afternoon!
Please tell me how to disable the display of the error page in laravel through Whoops?
The script itself works correctly and there are no complaints in the work, but when you open a certain address in the browser, the Whoops error page pops up. (/vendor/laravel/framework/src/Illuminate/Routing/ and further various folders and files with errors).
I didn't find the .env file anywhere!
I tried to disable error output through the .htaccess file, this page does not help anyway.
Answer the question
In order to leave comments, you need to log in
The problem was solved by poking.
In /vendor/laravel/framework/src/Illuminate/Exception/ExceptionServiceProvider.php
In line 99: with($whoops = new Run)->allowQuit(false); set true and instead of the error page a white page)!
turns on production in .env or in configs as a last resort.
maybe that's why the error?
I wouldn't go into vendor at all.
It's better to edit app/Exceptions/Handler.php here.
My example
/**
* 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 ($exception instanceof MethodNotAllowedHttpException) {
if ($request->ajax()) {
return response()->json(['error' => 'method invaild.'], 404);
}
abort(404);
}
return parent::render($request, $exception);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question