// Add this function in Handler.php laravel
/**
* Register the exception handling callbacks for the application.
*
* @return void
*/
public function register()
{
$this->renderable(function (Exception $e, $request) {
ErrorLog::addToLog('Exception: ', $e);
return GlobalApiResponse::getResponse((string) 500, null, $e->getMessage());
});
}
php artisan vendor:publish --tag=laravel-errors
it will generate an "errors" folder in views