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