belongsTo(User::class,'to_user_id','id',[],'LEFT')->setEagerlyType(0); } /** * 关联用户 */ public function fromUser(): \think\model\relation\BelongsTo { return $this->belongsTo(User::class,'from_user_id','id',[],'LEFT')->setEagerlyType(0); } /** * 关联会员卡 */ public function card(): \think\model\relation\BelongsTo { return $this->belongsTo(UserCard::class,'user_card_id','id',[],'LEFT')->setEagerlyType(0); } /** * 关联会员卡类别 */ public function category(): \think\model\relation\BelongsTo { return $this->belongsTo('\app\admin\model\xilufitness\card\Category','card_category_id','id',[],'LEFT')->setEagerlyType(0); } }