*/ protected $fillable = [ 'dept_id', 'dept_name', 'category_id', 'building_id', 'dept_location', 'icon', 'introduction', 'sort', 'is_enable' ]; /** * The attributes that should be cast. * * @var array */ protected $casts = [ 'id' => 'integer', 'category_id' => 'integer', 'sort' => 'integer', 'is_enable' => 'integer', ]; /** * 科室分类 * @return BelongsTo */ public function departmentCategory(): BelongsTo { return $this->belongsTo(DepartmentCategory::class, 'category_id'); } /** * 获取科室医生 * @return HasMany */ public function doctor(): HasMany { return $this->hasMany(Doctor::class, 'dept_id', 'dept_id'); } /** * 获取楼群信息 * @return BelongsTo */ public function buildingDistribution(): BelongsTo { return $this->belongsTo(BuildingDistribution::class, 'building_id'); } }