reportable(function (Throwable $e) { // }); // Redirect to home with a toast when a video URL can't be resolved $this->renderable(function (NotFoundHttpException $e, $request) { $prev = $e->getPrevious(); $isVideoRoute = str_starts_with($request->path(), 'videos/'); if ($isVideoRoute && ($prev instanceof ModelNotFoundException || $e->getMessage() === '')) { return redirect('/')->with('toast_error', 'This video is no longer available.'); } }); } }