Sector.php 980 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Model;
  4. use Hyperf\DbConnection\Model\Model;
  5. /**
  6. */
  7. class Sector extends Model
  8. {
  9. /**
  10. * The table associated with the model.
  11. */
  12. protected ?string $table = 'sector';
  13. /**
  14. * The attributes that are mass assignable.
  15. */
  16. protected array $fillable = [];
  17. /**
  18. * The attributes that should be cast to native types.
  19. */
  20. protected array $casts = [];
  21. /**
  22. * 定义与 sectorComponents 的关联关系
  23. *
  24. * @return \Hyperf\Database\Model\Relations\HasMany|\Hyperf\Database\Model\Relations\BelongsTo|\Hyperf\Database\Model\Relations\HasOne
  25. * 注意:这里需要根据实际业务确定具体的关联类型,示例中暂未明确指定
  26. */
  27. public function sectorComponents()
  28. {
  29. // 请根据实际业务逻辑修改关联类型,如 hasMany、belongsTo、hasOne 等
  30. return $this->hasMany(SectorComponent::class, 'sectorid', 'id');
  31. }
  32. }