enabled = true; } public function applyScope(Model $model): void { if ($this->enabled && $model instanceof BelongsToUser) { $model->addGlobalScope(new UserScope()); } } }