Add new search of articles

This commit is contained in:
Ludovic CANDELLIER
2022-02-21 09:09:36 +01:00
parent c75f580ad2
commit 3c3481b39d
4 changed files with 18 additions and 9 deletions

View File

@@ -28,7 +28,6 @@ class Tariff extends Model
public function sale_channels()
{
// return $this->HasManyThrough(SaleChannel::class, PriceList::class);
return $this->HasManyThrough(SaleChannel::class, PriceList::class, 'id', 'id', 'id', 'sale_channel_id');
}
@@ -73,10 +72,10 @@ class Tariff extends Model
public function scopeActive($query)
{
return $query->byStatus(0)->byPriceListsActive();
return $query->byStatus(0)->hasPriceListsActive();
}
public function scopeByPriceListsActive($query)
public function scopeHasPriceListsActive($query)
{
return $query->whereHas('price_lists', function ($query) {
$query->active();