hypothetical/app/Http/Middleware/Authenticate.php

18 lines
409 B
PHP
Raw Normal View History

<?php
namespace App\Http\Middleware;
use Illuminate\Auth\Middleware\Authenticate as Middleware;
2023-03-13 17:33:19 -04:00
use Illuminate\Http\Request;
class Authenticate extends Middleware
{
/**
* Get the path the user should be redirected to when they are not authenticated.
*/
2023-03-13 17:33:19 -04:00
protected function redirectTo(Request $request): ?string
{
2023-03-13 17:33:19 -04:00
return $request->expectsJson() ? null : route('login');
}
}