change construction of articles/offers
This commit is contained in:
@@ -64,7 +64,7 @@ class Offer extends Model
|
||||
|
||||
public function scopeActive($query)
|
||||
{
|
||||
return $query->where($this->table . '.status_id', 1);
|
||||
return $query->byStatus(1)->byTariffActive();
|
||||
}
|
||||
|
||||
public function scopeByArticle($query, $id)
|
||||
@@ -77,6 +77,11 @@ class Offer extends Model
|
||||
return $query->whereIn($this->table . '.article_id', $ids);
|
||||
}
|
||||
|
||||
public function scopeByID($query, $id)
|
||||
{
|
||||
return $query->where($this->table . '.id', $id);
|
||||
}
|
||||
|
||||
public function scopeByOffer($query, $id)
|
||||
{
|
||||
return $query->where($this->table . '.id', $id);
|
||||
@@ -126,4 +131,11 @@ class Offer extends Model
|
||||
$query->whereIn('tag_id', $tags);
|
||||
});
|
||||
}
|
||||
|
||||
public function scopeByTariffActive($query)
|
||||
{
|
||||
return $query->whereHas('tariff', function ($query) {
|
||||
$query->active();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user