2020-12-31 16:16:52 +01: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-02-19 11:54:03 +01:00
|
|
|
* @param \Illuminate\Http\Request $request
|
|
|
|
*
|
2020-12-31 16:16:52 +01:00
|
|
|
* @return string|null
|
|
|
|
*/
|
|
|
|
protected function redirectTo($request)
|
|
|
|
{
|
2021-02-19 11:54:03 +01:00
|
|
|
if (!$request->expectsJson()) {
|
2020-12-31 16:16:52 +01:00
|
|
|
return route('login');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|