Merge pull request #1972 from burakcakirel/fix-landing-page-issue

Fix landing page issue
This commit is contained in:
Cüneyt Şentürk 2021-04-06 11:38:14 +03:00 committed by GitHub
commit d113eb105c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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)