/**
  * Handle incoming requests.
  * @param Request $request
  * @param \Closure $next
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function handle($request, Closure $next)
 {
     if ($this->maintenance->isDownMode()) {
         if ($this->view->exists('errors.503')) {
             return new Response($this->view->make('errors.503'), 503);
         }
         return $this->app->abort(503, 'The application is down for maintenance.');
     }
     return $next($request);
 }
 /**
  * Handle incoming requests.
  *
  * @param Request $request
  * @param \Closure $next
  *
  * @return \Symfony\Component\HttpFoundation\Response
  * @throws \Symfony\Component\HttpKernel\Exception\HttpException
  * @throws \InvalidArgumentException
  */
 public function handle($request, Closure $next)
 {
     if ($this->maintenance->isDownMode() && !$this->maintenance->checkAllowedIp($this->getIp())) {
         if (app()['view']->exists('errors.503')) {
             return new Response(app()['view']->make('errors.503'), 503);
         }
         return app()->abort(503, 'The application is down for maintenance.');
     }
     return $next($request);
 }
 /**
  * Set Application Down Mode.
  *
  * @return void
  */
 public function setDownMode()
 {
     $this->maintenance->setDownMode();
     $this->info('Application is now in maintenance mode.');
 }
 /**
  * @param MaintenanceModeService $service
  */
 public function assertSetDownMode(MaintenanceModeService $service)
 {
     $service->setDownMode();
     $this->assertFileExists($service->maintenanceFilePath());
 }