Files
ntspi-app/app/Http/Middleware/Authenticate.php
T
2026-03-20 21:47:02 +05:00

19 lines
496 B
PHP
Executable File

<?php
namespace App\Http\Middleware;
use Illuminate\Auth\Access\AuthorizationException;
use Illuminate\Auth\Middleware\Authenticate as Middleware;
use Illuminate\Http\Request;
class Authenticate extends Middleware
{
/**
* Get the path the user should be redirected to when they are not authenticated.
*/
protected function redirectTo(Request $request): ?string
{
return $request->expectsJson() ? null : throw new AuthorizationException('Forbidden', 403);
}
}