refactor, better class namespace intergration
This commit is contained in:
@@ -16,31 +16,31 @@ class PriceList extends Model
|
||||
|
||||
public function tariff()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\Tariff');
|
||||
return $this->belongsTo(Tariff::class);
|
||||
}
|
||||
|
||||
public function sale_channel()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\SaleChannel');
|
||||
return $this->belongsTo(SaleChannel::class);
|
||||
}
|
||||
|
||||
public function price_list_values()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\PriceListValue');
|
||||
return $this->hasMany(PriceListValue::class);
|
||||
}
|
||||
|
||||
public function scopeByTariff($query, $id)
|
||||
{
|
||||
return $query->where('tariff_id', $id);
|
||||
return $query->where($this->table . '.tariff_id', $id);
|
||||
}
|
||||
|
||||
public function scopeBySaleChannel($query, $id)
|
||||
{
|
||||
return $query->where('sale_channel_id', $id);
|
||||
return $query->where($this->table . '.sale_channel_id', $id);
|
||||
}
|
||||
|
||||
public function scopeByStatus($query, $id)
|
||||
{
|
||||
return $query->where('status_id', $id);
|
||||
return $query->where($this->table . '.status_id', $id);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user