userOrder的model
class PlatformUserOrder extends Model
{
protected $connection = 'lws_edu';
protected $table = 'user_orders';
protected $fillable = [
'order_num',
'user_id',
'description',
'account',
'total_fee',
'state',
'user_consignee',
'user_phone',
'wx_num',
'create_time',
'pay_time',
'wxpay_result_code',
'wxpay_is_subscribe',
'wxpay_bank_type',
'wxpay_nonce_str',
'is_removed',
'transaction_id',
];
public function user()
{
return $this->belongsTo('App\Models\LwsPlatform\PlatformUser','user_id','id');
}
public function userOrderGoods()
{
return $this->hasMany('App\Models\LwsPlatform\PlatformUserOrderGoods');
}
}
userOrderGoods:
class PlatformUserOrderGoods extends Model
{
protected $connection = 'lws_edu';
protected $table = 'user_order_goods';
protected $fillable = ['user_order_id','goods_id','order_goods_price','state','count','is_removed'];
public function userOrder()
{
return $this->belongsTo('App\Models\LwsPlatform\PlatformUserOrderGoods','user_order_id','id');
}
}