session expired in laravel page not redirect login page code example
Example: laravel page expired redirect to login
# add function in app/Exceptions/Handler.php
protected function prepareException(Exception $e)
{
if ($e instanceof ModelNotFoundException) {
$e = new NotFoundHttpException($e->getMessage(), $e);
} elseif ($e instanceof AuthorizationException) {
$e = new AccessDeniedHttpException($e->getMessage(), $e);
} elseif ($e instanceof TokenMismatchException) {
return redirect()->route('login');
}
return $e;
}