GameConsumeGroup.php 999 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. class GameConsumeGroup extends ModelCore
  18. {
  19. /**
  20. * 与模型关联的表名
  21. *
  22. * @var string
  23. */
  24. protected $table = 'game_consume_groups';
  25. // attrlist start
  26. protected $fillable = [
  27. 'id',
  28. 'name',
  29. 'code',
  30. 'description',
  31. ];
  32. // attrlist end
  33. /**
  34. * 获取消耗组中的所有消耗项
  35. *
  36. * @return HasMany
  37. */
  38. public function consumeItems(): HasMany
  39. {
  40. return $this->hasMany(GameConsumeItem::class, 'group_id', 'id');
  41. }
  42. }