where("entity_id", $model->id)->get(); $photoArr = []; foreach ($photos as $photo) { $photoArr[] =$photo->image; } return $photoArr; } public function getItem(string $entity, string $entity_id): string { $photos = Photo::where("entity", $entity)->where("entity_id", $entity_id)->first(); if ($photos){ return $photos->image; } return ""; } }