FundCurrencyModel.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. namespace App\Module\Fund\Models;
  3. use App\Module\Fund\Casts\FundCurrencyDisplayAttributesCast;
  4. use UCore\ModelCore;
  5. /**
  6. * 币种配置表
  7. *
  8. * 用于存储系统支持的各种币种信息,如美元、人民币、比特币等。
  9. * 一个币种可以对应多个账户种类(FundConfigModel)。
  10. *
  11. * field start
  12. * @property int $id 自增
  13. * @property string $identification 资金标识
  14. * @property string $icon 资金标识
  15. * @property string $name 资金名字
  16. * @property string $data1 数据
  17. * @property \App\Module\Fund\Casts\FundCurrencyDisplayAttributesCast $display_attributes 显示属性,如图标、颜色等
  18. * @property int $create_time
  19. * @property int $update_time 更新时间
  20. * field end
  21. */
  22. class FundCurrencyModel extends ModelCore
  23. {
  24. protected $table = 'fund_currency';
  25. // attrlist start
  26. protected $fillable = [
  27. 'id',
  28. 'identification',
  29. 'icon',
  30. 'name',
  31. 'data1',
  32. 'display_attributes',
  33. 'create_time',
  34. 'update_time',
  35. ];
  36. // attrlist end
  37. /**
  38. * 应该被转换为原生类型的属性
  39. *
  40. * @var array
  41. */
  42. protected $casts = [
  43. 'display_attributes' => FundCurrencyDisplayAttributesCast::class,
  44. ];
  45. public $timestamps = false;
  46. /**
  47. * 获取该币种的所有账户种类
  48. *
  49. * 一个币种可以有多个账户种类,这是一对多关系中的"一"一方
  50. *
  51. * @return \Illuminate\Database\Eloquent\Relations\HasMany
  52. */
  53. public function fundConfigs()
  54. {
  55. return $this->hasMany(FundConfigModel::class, 'currency_id');
  56. }
  57. }