cards
This commit is contained in:
@ -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 "";
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user