Add variations, slider, fix cart ...
This commit is contained in:
@@ -150,4 +150,35 @@ class Offer extends Model
|
||||
$query->active()->bySaleChannel($sale_channel_id);
|
||||
});
|
||||
}
|
||||
|
||||
public function scopeWithPriceListsBySaleChannel($query, $sale_channel_id)
|
||||
{
|
||||
return $query->with([
|
||||
'price_lists' => function($query) use ($sale_channel_id) {
|
||||
$query->bySaleChannel($sale_channel_id);
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
||||
public function scopeWithPriceListValuesBySaleChannel($query, $sale_channel_id)
|
||||
{
|
||||
return $query->with([
|
||||
'price_lists' => function($query) use ($sale_channel_id) {
|
||||
$query->bySaleChannel($sale_channel_id);
|
||||
},
|
||||
'price_lists.price_list_values',
|
||||
]);
|
||||
}
|
||||
|
||||
public function scopeWithPriceBySaleChannelByQuantity($query, $sale_channel_id, $quantity = 1)
|
||||
{
|
||||
return $query->with([
|
||||
'price_lists' => function($query) use ($sale_channel_id) {
|
||||
$query->bySaleChannel($sale_channel_id);
|
||||
},
|
||||
'price_lists.price_list_values' => function($query) use ($quantity) {
|
||||
$query->byQuantity($quantity);
|
||||
},
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user