Try to fix price_lists by sale_channel

This commit is contained in:
Ludovic CANDELLIER
2022-03-30 00:36:58 +02:00
parent ff18a0f5bf
commit c4bb4fdd59
8 changed files with 54 additions and 25 deletions

View File

@@ -39,4 +39,12 @@ class PriceListValue extends Model
{
return $query->orderBy('quantity', 'desc')->where($this->table . '.quantity', '<=', $quantity)->first();
}
public function scopeBySaleChannel($query, $sale_channel_id) {
return $query->with([
'price_list' => function ($query) use ($sale_channel_id) {
return $query->bySaleChannel($sale_channel_id);
},
]);
}
}