misc_pterodactyl-panel/app/Http/Middleware/AdminAuthenticate.php
Matthew Penner 3ea6d45cda
php-cs-fixer
2022-11-29 10:53:59 -07:00

23 lines
554 B
PHP

<?php
namespace Pterodactyl\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);
}
}