MaintenanceFilter.php 593 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php namespace App\Http\Filters;
  2. use Illuminate\Http\Response;
  3. use Illuminate\Contracts\Foundation\Application;
  4. class MaintenanceFilter {
  5. /**
  6. * The application implementation.
  7. *
  8. * @var Application
  9. */
  10. protected $app;
  11. /**
  12. * Create a new filter instance.
  13. *
  14. * @param Application $app
  15. * @return void
  16. */
  17. public function __construct(Application $app)
  18. {
  19. $this->app = $app;
  20. }
  21. /**
  22. * Run the request filter.
  23. *
  24. * @return mixed
  25. */
  26. public function filter()
  27. {
  28. if ($this->app->isDownForMaintenance())
  29. {
  30. return new Response('Be right back!', 503);
  31. }
  32. }
  33. }