<?php

namespace Modules\Admin\app\Http\Middleware;

use Closure;
use Illuminate\Auth\Middleware\Authenticate as MiddlewareAuthenticate;
use Illuminate\Support\Facades\Config;
use Modules\Admin\app\Models\Admin;
use Tymon\JWTAuth\Facades\JWTAuth;
use Tymon\JWTAuth\JWTAuth as JWTAuthJWTAuth;

class AdminMiddleware
{
    /**
     * Handle an incoming request.
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     */
    public function handle($request, Closure $next, ...$guards)
    {
        if (auth('admins')->check()) {
            return $next($request);
        } else {
            return response()->json([
                'Unauthenticated.'
            ], 401);
        }
    }
}
