Remove useless middleware

This commit is contained in:
Bubka 2024-07-05 16:33:00 +02:00
parent e238e5121c
commit ee1d7a3993
2 changed files with 0 additions and 36 deletions

View File

@ -74,7 +74,6 @@ class Kernel extends HttpKernel
'auth' => \App\Http\Middleware\Authenticate::class,
'admin' => \App\Http\Middleware\AdminOnly::class,
'guest' => \App\Http\Middleware\RejectIfAuthenticated::class,
'SkipIfAuthenticated' => \App\Http\Middleware\SkipIfAuthenticated::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'rejectIfDemoMode' => \App\Http\Middleware\RejectIfDemoMode::class,
'rejectIfReverseProxy' => \App\Http\Middleware\RejectIfReverseProxy::class,

View File

@ -1,35 +0,0 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class SkipIfAuthenticated
{
/**
* Handle an incoming request.
*
* @param string|null ...$guards
* @return mixed
*/
public function handle(Request $request, Closure $next, ...$guards)
{
$guards = empty($guards) ? [null] : $guards;
foreach ($guards as $guard) {
if (Auth::guard($guard)->check()) {
$user = Auth::guard($guard)->user();
return response()->json([
'message' => 'authenticated',
'name' => $user->name,
'preferences' => $user->preferences,
], 200);
}
}
return $next($request);
}
}