hasOne(Owner::class,"id","owner_id"); } public function ownerBillReport() { //账单 return $this->hasOne(OwnerBillReport::class,"id","owner_bill_report_id"); } /* 结算月格式转换,仅截取至月 * 引用:CreateOwnerReport */ public function getCountingMonthAttribute($value) { return substr($value,0,7); } public function getTotalAttribute() { //总单量 return $this->to_business_quantity + $this->to_customer_quantity; } }