2020-05-23 19:05:18 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Middleware;
|
|
|
|
|
|
|
|
|
|
use Illuminate\Auth\Middleware\Authenticate as Middleware;
|
2023-05-24 22:21:54 +02:00
|
|
|
use Illuminate\Http\Request;
|
2020-05-23 19:05:18 +02:00
|
|
|
|
|
|
|
|
class Authenticate extends Middleware
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* Get the path the user should be redirected to when they are not authenticated.
|
|
|
|
|
*/
|
2023-05-24 22:21:54 +02:00
|
|
|
protected function redirectTo(Request $request): ?string
|
2020-05-23 19:05:18 +02:00
|
|
|
{
|
|
|
|
|
if (! $request->expectsJson()) {
|
|
|
|
|
return route('login');
|
|
|
|
|
}
|
2023-05-24 22:21:54 +02:00
|
|
|
|
|
|
|
|
return null;
|
2020-05-23 19:05:18 +02:00
|
|
|
}
|
|
|
|
|
}
|