Fix landing page issue

This commit is contained in:
Burak Çakırel 2021-04-05 23:46:52 +03:00
parent 31093a9f1e
commit 94246795d7
No known key found for this signature in database
GPG Key ID: 48FFBB7771B99C7C

View File

@ -5,8 +5,8 @@ namespace App\Exceptions;
use Illuminate\Auth\AuthenticationException;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Debug\Exception\FatalThrowableError;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Throwable;
class Handler extends ExceptionHandler
@ -71,11 +71,13 @@ class Handler extends ExceptionHandler
protected function unauthenticated($request, AuthenticationException $exception)
{
// Store the current url in the session
session(['url.intended' => $request->url()]);
if ($request->url() !== config('app.url')) {
session(['url.intended' => $request->url()]);
}
return $request->expectsJson()
? response()->json(['message' => $exception->getMessage()], 401)
: redirect()->guest($exception->redirectTo() ?? route('login'));
? response()->json(['message' => $exception->getMessage()], 401)
: redirect()->to($exception->redirectTo() ?? route('login'));
}
private function handleExceptions($request, $exception)