fix: custom Authenticate middleware returns null redirectTo — prevents Route[login] not defined 500

This commit is contained in:
li
2026-03-14 17:58:26 +08:00
parent 0f721bcc09
commit 39234a0f4d
2 changed files with 21 additions and 2 deletions
@@ -0,0 +1,18 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Auth\Middleware\Authenticate as Middleware;
use Illuminate\Http\Request;
class Authenticate extends Middleware
{
/**
* API-only project never redirect, always return null so Laravel
* responds with a 401 JSON response instead of looking for a "login" route.
*/
protected function redirectTo(Request $request): ?string
{
return null;
}
}