refactor, better class namespace intergration

This commit is contained in:
Ludovic CANDELLIER
2021-10-04 14:09:51 +02:00
parent a7f661ab10
commit c150be2c3e
26 changed files with 68 additions and 78 deletions

View File

@@ -17,16 +17,16 @@ class PriceListValue extends Model
public function price_list()
{
return $this->belongsTo('App\Models\Shop\PriceList');
return $this->belongsTo(PriceList::class);
}
public function scopeByPriceList($query, $id)
{
return $query->where('price_list_id', $id);
return $query->where($this->table . '.price_list_id', $id);
}
public function scopeByQuantity($query, $quantity)
{
return $query->orderBy('quantity', 'desc')->where('quantity', '<', $quantity)->first();
return $query->orderBy('quantity', 'desc')->where($this->table . '.quantity', '<', $quantity)->first();
}
}