fix bad call to gallery()
This commit is contained in:
@@ -34,9 +34,9 @@ trait HasAttachments
|
|||||||
}
|
}
|
||||||
|
|
||||||
$ids = array_map('trim', $ids);
|
$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) {
|
foreach ($ids as $id) {
|
||||||
if ($allowDuplicates === false && in_array($id, $existingIds) === true) {
|
if ($allowDuplicates === false && in_array($id, $existingIds) === true) {
|
||||||
continue;
|
continue;
|
||||||
@@ -44,11 +44,11 @@ trait HasAttachments
|
|||||||
|
|
||||||
$media = Media::find($id);
|
$media = Media::find($id);
|
||||||
if ($media !== null) {
|
if ($media !== null) {
|
||||||
$galleryItems[] = ['media_id' => $id];
|
$attachmentItems[] = ['media_id' => $id];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->attachments()->createMany($galleryItems);
|
$this->attachments()->createMany($attachmentItems);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user