change construction of articles/offers

This commit is contained in:
Ludovic CANDELLIER
2022-02-20 21:38:21 +01:00
parent cbe397be6a
commit 36f16921bb
7 changed files with 54 additions and 25 deletions

View File

@@ -50,10 +50,15 @@ class PriceList extends Model
return $query->where($this->table . '.status_id', $id);
}
public function scopeActive($query)
{
return $query->byStatus(0)->has('price_list_values');
}
public function scopeByOffer($query, $id)
{
return $query->whereHas('offers', function ($query) use ($id) {
$query->byOffer($id);
$query->byID($id);
});
}
}