[ 'Content-Type' => 'application/json', ], ]); $guzzle->post( env('SLACK_WEBHOOK_URL'), [ 'body' => json_encode([ 'attachments' => [[ 'fallback' => 'There was an exception.', 'pretext' => 'There was an exception.', 'color' => '#d00000', 'author_name' => app()->environment(), 'author_link' => config('app.url'), 'fields' => [[ 'title' => get_class($exception) ?? 'Unkown Exception', 'value' => $exception->getMessage() ?? '', ]], 'ts' => time(), ]], ]), ] ); parent::report($exception); } /** * 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 TokenMismatchException) { Route::getRoutes()->match($request); } return parent::render($request, $exception); } }