isMaintenance.php 613 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. namespace App\Http\Middleware;
  3. use Closure;
  4. use Illuminate\Http\Request;
  5. class isMaintenance
  6. {
  7. /**
  8. * 校验是否开启维护模式.
  9. *
  10. * @param Request $request
  11. * @param Closure $next
  12. * @return mixed
  13. */
  14. public function handle(Request $request, Closure $next)
  15. {
  16. if (sysConfig('maintenance_mode')) {
  17. return response()->view('auth.maintenance', [
  18. 'message' => sysConfig('maintenance_content'),
  19. 'time' => sysConfig('maintenance_time') ?: '0',
  20. ]);
  21. }
  22. return $next($request);
  23. }
  24. }