misc_pterodactyl-panel/app/Http/Middleware/AdminAuthenticate.php
Matthew Penner cbcf62086f
Upgrade to Laravel 9 (#4413)
Co-authored-by: DaneEveritt <dane@daneeveritt.com>
2022-10-14 10:59:20 -06:00

24 lines
566 B
PHP

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