feat(entry): enhance variant filtering in all method to exclude replaced and disabled variants
This commit is contained in:
@@ -24,8 +24,13 @@ class EntryService
|
|||||||
return CatalogItem::query()
|
return CatalogItem::query()
|
||||||
->where('tenant_code', $tenant->codigo)
|
->where('tenant_code', $tenant->codigo)
|
||||||
->whereHas('category', fn ($query) => $query->where('nombre', 'Entradas'))
|
->whereHas('category', fn ($query) => $query->where('nombre', 'Entradas'))
|
||||||
|
->whereHas('variants', fn ($query) => $query
|
||||||
|
->whereNull('replaced_by_variant_id')
|
||||||
|
->whereNull('sales_disabled_at'))
|
||||||
->with([
|
->with([
|
||||||
'variants' => fn ($query) => $query->whereNull('replaced_by_variant_id'),
|
'variants' => fn ($query) => $query
|
||||||
|
->whereNull('replaced_by_variant_id')
|
||||||
|
->whereNull('sales_disabled_at'),
|
||||||
'variants.inventory',
|
'variants.inventory',
|
||||||
'variants.eventDate',
|
'variants.eventDate',
|
||||||
'variants.eventDates',
|
'variants.eventDates',
|
||||||
|
|||||||
Reference in New Issue
Block a user