'Ⅰ类', self::NOFREETYPE => 'Ⅱ类', ]; public static function getType(){ return self::$_type; } //导入格式 protected $fillable = ['type','price',"name","remark","supplier",'stock','states']; public function organization() { return $this->belongsToMany(Organization::class,'org_id'); } protected function getUseCountAttribute() { $id = $this->attributes['id']; if(empty($id)) return 0; return OrderVaccine::where(['vaccine_id'=>$id])->whereHas('orders',function($query){ $query->where('order_status',4); })->count(); } protected function getAppointCountAttribute() { $id = $this->attributes['id']; if(empty($id)) return 0; return OrderVaccine::where(['vaccine_id'=>$id])->whereHas('orders',function($query){ $query->where('order_status',3); })->count(); } public function organizationvaccines(){ return $this->hasMany(OrganizationVaccines::class,'vaccine_id'); } }