Add deep relations
This commit is contained in:
@@ -20,6 +20,20 @@ class PriceListValue extends Model
|
||||
return $this->belongsTo(PriceList::class);
|
||||
}
|
||||
|
||||
public function tariff()
|
||||
{
|
||||
return $this->belongsToThrough(
|
||||
'App\Models\Shop\Tariff',
|
||||
'App\Models\Shop\PriceList',
|
||||
null,
|
||||
'',
|
||||
[
|
||||
'App\Models\Shop\Tariff' => 'tariff_id',
|
||||
'App\Models\Shop\PriceList' => 'price_list_id'
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
public function scopeByPriceList($query, $id)
|
||||
{
|
||||
return $query->where($this->table . '.price_list_id', $id);
|
||||
|
||||
Reference in New Issue
Block a user