You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I call $model->syncTags($tags) (or one of the other methods) I want to touch $model if any tags have changed.
However, looking at the code, the only way to do that is to override all those methods and do it manually. I currently only use syncTags, and I added the following to it:
$result = $this->tags()->sync($tags->pluck('id')->toArray());
if (array_filter($result)) {
$this->touch();
}
Is there a better way to do this? Or any interest to make this part of the package (as a config option)? I'd consider making a PR for it.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi,
When I call
$model->syncTags($tags)
(or one of the other methods) I want to touch$model
if any tags have changed.However, looking at the code, the only way to do that is to override all those methods and do it manually. I currently only use syncTags, and I added the following to it:
Is there a better way to do this? Or any interest to make this part of the package (as a config option)? I'd consider making a PR for it.
Beta Was this translation helpful? Give feedback.
All reactions