PetConfig.php 1.2 KB

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