123456789101112131415161718192021222324 |
- <?php
- namespace App\Http\Middleware;
- use App\Models\User\User;
- use App\Modules\Admin\Services\AuthService;
- use Closure;
- use Illuminate\Auth\AuthenticationException;
- use Illuminate\Http\Request;
- use Illuminate\Support\Facades\Auth;
- class CheckAuthMiddleware
- {
- public function handle(Request $request, Closure $next)
- {
- $user = Auth::user();
- if (is_null($user)) {
- return response()->json([
- "code" => 401,
- ]);
- }
- return $next($request);
- }
- }
|