belongsTo('Camp','camp_id','id',[],'LEFT')->setEagerlyType(0); } /** * 关联门店 */ public function shop(){ return $this->belongsTo(Shop::class,'shop_id','id',[],'LEFT')->setEagerlyType(0); } /** * 关联教练 */ public function coach(){ return $this->belongsTo(Coach::class,'coach_id','id',[],'LEFT')->setEagerlyType(0); } /** * 计划时间 */ public function getplansAttr($value,$data){ $model = new WorkCampPlan(); return $model->where(['work_camp_id' => $data['id'] ?? 0]) ->field(['id','day_date','day_start_at','day_end_at','week']) ->select(); } }