request->attributes->get('api_key'); if (! $model->relationLoaded('permissions')) { throw new PterodactylException('Permissions must be loaded onto a model before passing to transformer authorize function.'); } $count = $model->getRelation('permissions')->filter(function ($model) use ($permission) { return $model->permission === $permission; })->count(); return $count > 0; } }