Skip to content

Commit

Permalink
get by primary key, instead of array
Browse files Browse the repository at this point in the history
  • Loading branch information
nivv committed Oct 16, 2024
1 parent 98b4b30 commit ed30469
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/ContentGetters/ImageGetter.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,14 @@ public static function get(RevisionMeta $meta, bool $publishing = false)
];
}

$image = Fabriq::getModelClass('image')
->whereIn('id', (array) $meta->meta_value);
if ($meta->meta_value === null) {
return null;
}

$image = self::getObjectOnce(self::getHash($image), $image);
$keyName = Fabriq::getModelClass('image')->getKeyName();
$image = Fabriq::getModelClass('image')
->where('id', $meta->meta_value[$keyName])
->first();

if (! $image) {
return null;
Expand Down

0 comments on commit ed30469

Please sign in to comment.