<?php namespace AppHttpMiddleware;
use Closure;
use IlluminateContractsFoundationApplication;
use IlluminateHttpRequest;
use IlluminateFoundationHttpMiddlewareCheckForMaintenanceMode as MaintenanceMode;
class CheckForMaintenanceMode {
protected $app;
public function __construct(Application $app)
{
$this->app = $app;
}
public function handle(Request $request, Closure $next)
{
if ($this->app->isDownForMaintenance() &&
!in_array($request->getClientIp(), ['8.8.8.8', '8.8.4.4']))
{
$maintenanceMode = new MaintenanceMode($this->app);
return $maintenanceMode->handle($request, $next);
}
return $next($request);
}
}