}); // Listen 404 App::missing(function ($exception) { // Get Path Info $pathInfo = currentPathInfo(); // Get Admin Alias Path $adminAliasPath = adminAliasPath(); // Match if (substr($pathInfo, 0, strlen($adminAliasPath)) == $adminAliasPath) { // Return Response return Response::view('laravel-admin::errors.missing', array("errorTitle" => "404 Page not Found", "exception" => $exception), 404); } }); App::down(function () { // Get Path Info $pathInfo = trim(currentPathInfo(), "/"); // Allowed $allowed = false; // Check for Login Page if (currentPathUrl() == urlRoute(\Developeryamhi\AuthModule\UserItem::loginRoute(), \Developeryamhi\AuthModule\UserItem::loginRouteParams()) || currentPathUrl() == urlRoute(\Developeryamhi\AuthModule\UserItem::logoutRoute(), \Developeryamhi\AuthModule\UserItem::logoutRouteParams())) { $allowed = true; } // Check for User if (!$allowed && Auth::check() && Auth::user()->canAccess("maintainance_mode")) { $allowed = true; } // Get IPs if Setting Created $maintainance_ip_use_as = getSetting("maintainance_ip_use_as"); $maintainance_ips = getSetting("maintainance_ips"); // Check if Setting is Valid if ($maintainance_ip_use_as && $maintainance_ips && !empty($maintainance_ips)) {
/** * Get Current Page URL */ function currentPathUrl() { return createBaseUrl(currentPathInfo()); }