2021-07-30 19:26:02 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Middleware;
|
|
|
|
|
|
|
|
use Illuminate\Auth\Middleware\Authenticate as Middleware;
|
|
|
|
|
|
|
|
class Authenticate extends Middleware
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Get the path the user should be redirected to when they are not authenticated.
|
|
|
|
*/
|
2021-08-03 19:43:16 +02:00
|
|
|
protected function redirectTo($request): string|null
|
2021-07-30 19:26:02 +02:00
|
|
|
{
|
2021-08-03 19:43:16 +02:00
|
|
|
if (!$request->expectsJson()) {
|
2021-12-14 19:26:13 +01:00
|
|
|
return route('auth.login');
|
2021-07-30 19:26:02 +02:00
|
|
|
}
|
2021-08-03 19:43:16 +02:00
|
|
|
return null;
|
2021-07-30 19:26:02 +02:00
|
|
|
}
|
|
|
|
}
|