feat(entry): simplify variant data handling in EntryResource by removing replaced variant logic
This commit is contained in:
parent
3d6548ce4a
commit
69bea10519
|
|
@ -12,14 +12,11 @@ class EntryResource extends JsonResource
|
|||
/** @return array<string, mixed> */
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
$variant = $this->variants->whereNull('replaced_by_variant_id')->sole();
|
||||
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'title' => $this->nombre,
|
||||
'description' => $this->descripcion,
|
||||
'event_date_ids' => $variant->selectedEventDates()->pluck('id')->values(),
|
||||
'stock' => $variant->inventory->real_stock,
|
||||
'variants' => $this->variants->toArray(),
|
||||
'price' => $this->precio,
|
||||
];
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue