refactor, better class namespace intergration
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user