From c47c5116741597072941300911c4144b7faaa795 Mon Sep 17 00:00:00 2001 From: James Collins Date: Mon, 24 Jul 2023 12:32:55 +1000 Subject: [PATCH] fix bad call to gallery() --- app/Traits/HasAttachments.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Traits/HasAttachments.php b/app/Traits/HasAttachments.php index db88eb4..e13eeec 100644 --- a/app/Traits/HasAttachments.php +++ b/app/Traits/HasAttachments.php @@ -34,9 +34,9 @@ trait HasAttachments } $ids = array_map('trim', $ids); - $existingIds = $this->gallery()->pluck('media_id')->toArray(); + $existingIds = $this->attachments()->pluck('media_id')->toArray(); - $galleryItems = []; + $attachmentItems = []; foreach ($ids as $id) { if ($allowDuplicates === false && in_array($id, $existingIds) === true) { continue; @@ -44,11 +44,11 @@ trait HasAttachments $media = Media::find($id); if ($media !== null) { - $galleryItems[] = ['media_id' => $id]; + $attachmentItems[] = ['media_id' => $id]; } } - $this->attachments()->createMany($galleryItems); + $this->attachments()->createMany($attachmentItems); } /**