shouldReport($exception)) { $this->sendEmail($exception); } parent::report($exception); } /** * Render an exception into an HTTP response. * * @param \Illuminate\Http\Request $request * @param \Throwable $exception * @return \Symfony\Component\HttpFoundation\Response * * @throws \Throwable */ public function render($request, Throwable $exception) { return parent::render($request, $exception); } public function sendEmail(Throwable $exception) { try { $e = FlattenException::create($exception); $handler = new HtmlErrorRenderer(true); // boolean, true raises debug flag... $css = $handler->getStylesheet(); $content = $handler->getBody($e); //Mail::to(config('app.exception_mail'))->send(new MailContact($contact)); \Mail::send('emails.exception', compact('css','content'), function ($message) { $message ->to(config('app.exception_mail')) ->subject('mivita Exception: ' . \Request::fullUrl()) ; }); } catch (Throwable $ex) { Log::error($ex); } } }