hasMany(OrderDetail::class,'order_id'); } public function order_details(){ return $this->hasManyThrough(Goodtest::class,OrderDetail::class,'order_id','id','id','goods_id'); } public function get_gift_infos(){ return $this->belongsToMany(Gift::class,OrderGift::class,'order_id','gift_id')->withPivot('num'); } public function get_user(){ return $this->belongsTo(User::class,'user_id'); } public function get_gift(){ return $this->hasMany(OrderGift::class,'order_id','id'); } public function get_log(){ return $this->hasMany(Orderlog::class,'order_id','id'); } public function address(){ return $this->belongsTo(Address::class,'address_id'); } public function get_address(){ return $this->belongsToMany(User::class,Address::class,'id','mobile','address_id','mobile')->whereIn('cert_status',[3,6]); } /**获取物流信息**/ public function get_express(){ return $this->hasMany(Express::class,'order_id'); } public function belong_user(){ return $this->belongsTo(User::class,'good_user_id'); } }