isLogin) { $newResponse = $response->withStatus(302)->withHeader('Location', '/auth/login'); return $newResponse; } $enablePages = array("/user/disable", "/user/backtoadmin", "/user/logout"); if ($user->enable == 0 && !in_array($_SERVER["REQUEST_URI"], $enablePages)) { $newResponse = $response->withStatus(302)->withHeader('Location', '/user/disable'); return $newResponse; } $response = $next($request, $response); return $response; } }