mirror of
				https://github.com/pelican-dev/panel.git
				synced 2025-10-26 07:26:51 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			33 lines
		
	
	
		
			715 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			33 lines
		
	
	
		
			715 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| namespace App\Http\Middleware;
 | |
| 
 | |
| use Illuminate\Http\Request;
 | |
| use Illuminate\Contracts\Routing\ResponseFactory;
 | |
| 
 | |
| class MaintenanceMiddleware
 | |
| {
 | |
|     /**
 | |
|      * MaintenanceMiddleware constructor.
 | |
|      */
 | |
|     public function __construct(private ResponseFactory $response)
 | |
|     {
 | |
|     }
 | |
| 
 | |
|     /**
 | |
|      * Handle an incoming request.
 | |
|      */
 | |
|     public function handle(Request $request, \Closure $next): mixed
 | |
|     {
 | |
|         /** @var \App\Models\Server $server */
 | |
|         $server = $request->attributes->get('server');
 | |
|         $node = $server->getRelation('node');
 | |
| 
 | |
|         if ($node->maintenance_mode) {
 | |
|             return $this->response->view('errors.maintenance');
 | |
|         }
 | |
| 
 | |
|         return $next($request);
 | |
|     }
 | |
| }
 | 
