AttachAction not adding entries with global scopes.

I am trying to attach a category to a post. Categories have a global scope to hide "machine tags". I have a select field which obviously doesn't show all categories, so added removeGlobalScopes to the query… however, when I SAVE that category relationship, nothing happens – it isn't attached to the post. If I remove the scope from the model or choose a non-machine-tag category it works.

Looking at the AttachAction code I can't work out why the $record ends up
null
as it is using Relation::noConstraints() in the action

AttachAction::make()->recordSelectOptionsQuery(
    static fn (Builder $query): Builder => $query->withoutGlobalScopes()
)
Was this page helpful?