feat: Add active pricing details to service list resource and eager load only active pricings in the service repository.
This commit is contained in:
@@ -32,6 +32,12 @@ class ServiceListResource extends JsonResource
|
||||
'stock' => $this->stock,
|
||||
'price' => $this->price,
|
||||
'price_sale' => $this->price_sale,
|
||||
'pricing' => $this->pricings->mapWithKeys(function ($pricing) {
|
||||
return [$pricing->billing_cycle => $pricing->price];
|
||||
}),
|
||||
'pricing_sale' => $this->pricings->mapWithKeys(function ($pricing) {
|
||||
return [$pricing->billing_cycle => $pricing->price_sale];
|
||||
}),
|
||||
'group' => $this->category->name,
|
||||
'os' => $this->osVersions->groupBy('os_group_id')->map(function ($versions) {
|
||||
$group = $versions->first()->osGroup;
|
||||
|
||||
Reference in New Issue
Block a user