reportable(function (Throwable $e) { if (app()->bound('sentry')) { app('sentry')->captureException($e); } }); } /** * Report or log an exception. * * * @param \Exception $exception * @return void * * @throws \Throwable */ public function report(\Throwable $exception) { parent::report($exception); } /** * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\RedirectResponse|\Symfony\Component\HttpFoundation\Response * * @throws \Throwable */ public function render($request, \Throwable $exception) { if ($exception instanceof \Spatie\Permission\Exceptions\UnauthorizedException) { abort(401); } if ($exception instanceof \Illuminate\Session\TokenMismatchException) { return redirect() ->back() ->withInput($request->except(['password', 'password_confirmation'])) ->with('error', 'The form has expired due to inactivity. Please refresh the page and try again'); } return parent::render($request, $exception); } }