<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

use App\Traits\ModelLogChanging;

class OwnerPriceLogisticDetail extends Model
{
    use ModelLogChanging;

    protected $fillable = [
        "owner_price_logistic_id",  //物流计费
        "unit_id",                  //单位ID
        "range",                    //区间
        "province_id",              //省份ID
        "city_id",                  //城市ID
        "unit_price",               //单价
        "delivery_fee",             //送货费
        "initial_fee",              //起始计费
        "initial_amount",           //起始计数
        "rate",                     //费率
    ];

    public function unit()
    { //单位
        return $this->hasOne(Unit::class,"id","unit_id");
    }
    public function province()
    { //省份
        return $this->hasOne(Province::class,"id","province_id");
    }
    public function city()
    { //城市
        return $this->hasOne(City::class,"id","city_id");
    }
    public function ownerPriceLogistic()
    {   //物流
        return $this->belongsTo(OwnerPriceLogistic::class,"owner_price_logistic_id","id");
    }
}
