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…
2 Replies
it isn't attached to the postYou checked that in the database? Or via Filament tables? If the latter: Did you remove the scope from the table query.
I checked the database.
And yes, the table query has the scope removed. I checked when I added one after I removed the scope and then re-added the scope and could see it on the table.
If I
dd()
in the AttachAction
$this->action()
method, the $record
is null…