'int', 'userid' => 'int', 'ordersn' => 'string', 'paymoney' => 'float', 'status' => 'int', 'paytype' => 'int', 'payremark' => 'string', 'remark' => 'string', 'createtime' => 'int' ]; // 设置json类型字段 protected $json = ['payremark']; // 设置字段自动转换类型 protected $type = [ 'createtime' => 'timestamp:Y-m-d H:i:s' ]; // 关联User public function user() { return $this->hasOne(User::class, "id", "userid"); } }