GameConsumeGroup.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. namespace App\Module\Game\Models;
  3. use Illuminate\Database\Eloquent\Relations\HasMany;
  4. use UCore\ModelCore;
  5. /**
  6. * 消耗组
  7. *
  8. * field start
  9. * @property int $id 主键
  10. * @property string $name 消耗组名称
  11. * @property string $code 消耗组编码(唯一)
  12. * @property string $description 消耗组描述
  13. * @property \Carbon\Carbon $created_at 创建时间
  14. * @property \Carbon\Carbon $updated_at 更新时间
  15. * field end
  16. *
  17. * @property-read GameConsumeItem[] $consumeItems 消耗组中的所有消耗项
  18. */
  19. class GameConsumeGroup extends ModelCore
  20. {
  21. /**
  22. * 与模型关联的表名
  23. *
  24. * @var string
  25. */
  26. protected $table = 'game_consume_groups';
  27. // attrlist start
  28. protected $fillable = [
  29. 'id',
  30. 'name',
  31. 'code',
  32. 'description',
  33. ];
  34. // attrlist end
  35. /**
  36. * 获取消耗组中的所有消耗项
  37. *
  38. * @return HasMany
  39. */
  40. public function consumeItems(): HasMany
  41. {
  42. return $this->hasMany(GameConsumeItem::class, 'group_id', 'id');
  43. }
  44. }