PetConfig.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. namespace App\Module\Pet\Models;
  3. use App\Module\Pet\Casts\GradeProbability;
  4. use UCore\ModelCore;
  5. use App\Module\Pet\Casts\DisplayAttributesCast;
  6. use App\Module\Pet\Casts\NumericAttributesCast;
  7. /**
  8. * 宠物配置模型
  9. *
  10. * field start
  11. * @property int $id
  12. * @property string $pet_type 宠物类型
  13. * @property string $name 宠物名字
  14. * @property \App\Module\Pet\Casts\GradeProbability $grade_probability 品阶概率配置
  15. * @property \App\Module\Pet\Casts\DisplayAttributesCast $display_attributes 显示属性配置
  16. * @property \App\Module\Pet\Casts\NumericAttributesCast $numeric_attributes 数值属性配置
  17. * @property \Carbon\Carbon $created_at
  18. * @property \Carbon\Carbon $updated_at
  19. * field end
  20. */
  21. class PetConfig extends ModelCore
  22. {
  23. /**
  24. * 与模型关联的表名
  25. *
  26. * @var string
  27. */
  28. protected $table = 'pet_configs';
  29. // attrlist start
  30. protected $fillable = [
  31. 'id',
  32. 'pet_type',
  33. 'name',
  34. 'grade_probability',
  35. 'display_attributes',
  36. 'numeric_attributes',
  37. ];
  38. // attrlist end
  39. /**
  40. * 应该被转换为原生类型的属性
  41. *
  42. * @var array
  43. */
  44. protected $casts = [
  45. 'grade_probability' => GradeProbability::class,
  46. 'display_attributes' => DisplayAttributesCast::class,
  47. 'numeric_attributes' => NumericAttributesCast::class,
  48. ];
  49. }