mirror of
				https://github.com/pelican-dev/panel.git
				synced 2025-11-04 13:16:51 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			24 lines
		
	
	
		
			546 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			24 lines
		
	
	
		
			546 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
 | 
						|
namespace App\Http\Middleware;
 | 
						|
 | 
						|
use Illuminate\Http\Request;
 | 
						|
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
 | 
						|
 | 
						|
class AdminAuthenticate
 | 
						|
{
 | 
						|
    /**
 | 
						|
     * Handle an incoming request.
 | 
						|
     *
 | 
						|
     * @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException
 | 
						|
     */
 | 
						|
    public function handle(Request $request, \Closure $next): mixed
 | 
						|
    {
 | 
						|
        if (!$request->user() || !$request->user()->root_admin) {
 | 
						|
            throw new AccessDeniedHttpException();
 | 
						|
        }
 | 
						|
 | 
						|
        return $next($request);
 | 
						|
    }
 | 
						|
}
 |