change construction of articles/offers
This commit is contained in:
@@ -50,8 +50,8 @@ class Tariff extends Model
|
||||
public function scopeByAutocomplete($query, $str)
|
||||
{
|
||||
return $query->where($this->table . '.name', 'LIKE', "%${str}%")
|
||||
->orWhere($this->table . '.ref', 'LIKE', "${str}%")
|
||||
->orWhere($this->table . '.code', 'LIKE', "${str}%");
|
||||
->orWhere($this->table . '.ref', 'LIKE', "${str}%")
|
||||
->orWhere($this->table . '.code', 'LIKE', "${str}%");
|
||||
}
|
||||
|
||||
public function scopeBySaleChanel($query, $id)
|
||||
@@ -67,7 +67,19 @@ class Tariff extends Model
|
||||
public function scopeByOffer($query, $id)
|
||||
{
|
||||
return $query->whereHas('offers', function ($query) use ($id) {
|
||||
$query->where('id', $id);
|
||||
$query->byID($id);
|
||||
});
|
||||
}
|
||||
|
||||
public function scopeActive($query)
|
||||
{
|
||||
return $query->byStatus(0)->byPriceListsActive();
|
||||
}
|
||||
|
||||
public function scopeByPriceListsActive($query)
|
||||
{
|
||||
return $query->whereHas('price_lists', function ($query) {
|
||||
$query->active();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user