where([ 'appointment_period' => AppointmentApplication::APPOINTMENT_PERIOD_MORNING, 'appointment_ticket_id' => $this->id, 'status' => ['<>', AppointmentApplication::STATUS_CANCEL] ])->count(); } //afternoon_use public function getAfternoonUseAttr($value, $data) { return (new AppointmentApplication())->where([ 'appointment_period' => AppointmentApplication::APPOINTMENT_PERIOD_AFTERNOON, 'appointment_ticket_id' => $this->id, 'status' => ['<>', AppointmentApplication::STATUS_CANCEL] ])->count(); } //night_use public function getNightUseAttr($value, $data) { return (new AppointmentApplication())->where([ 'appointment_period' => AppointmentApplication::APPOINTMENT_PERIOD_NIGHT, 'appointment_ticket_id' => $this->id, 'status' => ['<>', AppointmentApplication::STATUS_CANCEL] ])->count(); } //关联专家 public function specialist() { return $this->belongsTo('Specialist', 'provider_id'); } //关联放号配置 public function appointment() { return $this->belongsTo('Appointment'); } //关联地址 public function address() { return $this->belongsTo('Address'); } }