| 123456789101112131415161718192021222324252627282930313233343536 |
- <?php
- namespace App;
- use Illuminate\Database\Eloquent\Model;
- class OwnerPriceLogistic extends Model
- {
- protected $fillable = [
- "name", //名称
- "unit_range", //单价一区间
- "unit_id", //单位一ID
- "other_unit_range", //单位二区间
- "other_unit_id", //单位二ID
- "pick_up_price", //提货费
- "fuel_price", //燃油附加费
- "service_price", //信息服务费
- ];
- public function unit()
- { //单位一
- return $this->hasOne(Unit::class,"id","unit_id");
- }
- public function otherUnit()
- { //单位二
- return $this->hasOne(Unit::class,"id","other_unit_id");
- }
- public function owners()
- { //货主
- return $this->belongsToMany(Owner::class,"owner_price_logistic_owner","owner_price_logistic_id","owner_id");
- }
- public function logistics()
- { //物流
- return $this->belongsToMany(Logistic::class,"owner_price_logistic_logistic","owner_price_logistic_id","logistic_id");
- }
- }
|