45 lines
925 B
PHP
45 lines
925 B
PHP
<?php
|
|
|
|
namespace App\Models\Shop;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Znck\Eloquent\Traits\BelongsToThrough;
|
|
|
|
class PriceList extends Model
|
|
{
|
|
use BelongsToThrough;
|
|
|
|
protected $guarded = ['id'];
|
|
protected $table = 'shop_price_lists';
|
|
|
|
public function tariff()
|
|
{
|
|
return $this->belongsTo('App\Models\Shop\Tariff');
|
|
}
|
|
|
|
public function sale_channel()
|
|
{
|
|
return $this->belongsTo('App\Models\Shop\SaleChannel');
|
|
}
|
|
|
|
public function price_list_values()
|
|
{
|
|
return $this->hasMany('App\Models\Shop\PriceListValue');
|
|
}
|
|
|
|
public function scopeByTariff($query, $id)
|
|
{
|
|
return $query->where('tariff_id', $id);
|
|
}
|
|
|
|
public function scopeBySaleChannel($query, $id)
|
|
{
|
|
return $query->where('sale_channel_id', $id);
|
|
}
|
|
|
|
public function scopeByStatus($query, $id)
|
|
{
|
|
return $query->where('status_id', $id);
|
|
}
|
|
}
|