user(); if (!$user || !$user->isAdmin()) { throw new AccessDeniedHttpException('This account does not have permission to access the API.'); } return $next($request); } }