Skip to content

Commit 65c07d0

Browse files
authored
Update HasTags.php (#523)
Make changes to avoid multiple pivotAttached event fired, removing loop into synTagIds method
1 parent 956dc06 commit 65c07d0

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/HasTags.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -287,9 +287,8 @@ protected function syncTagIds($ids, string | null $type = null, $detaching = tru
287287
// Attach any new ids
288288
$attach = array_unique(array_diff($ids, $current));
289289
if (count($attach) > 0) {
290-
collect($attach)->each(function ($id) {
291-
$this->tags()->attach($id, []);
292-
});
290+
$this->tags()->attach($attach, []);
291+
293292
$isUpdated = true;
294293
}
295294

0 commit comments

Comments
 (0)