This commit is contained in:
2025-01-19 17:15:58 +03:00
parent 40369fb515
commit b18378bcb1
41 changed files with 1257 additions and 30 deletions

View File

@ -2,7 +2,31 @@
namespace app\modules\photo;
use Illuminate\Database\Eloquent\Model;
use kernel\app_modules\photo\models\Photo;
class PhotoModule extends \kernel\app_modules\photo\PhotoModule
{
public function getItems(string $entity, Model $model): array|string
{
$photos = Photo::where("entity", $entity)->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 "";
}
}