WashGoods.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. namespace app\model\wash;
  3. use app\extra\basic\Model;
  4. /**
  5. * @property integer $id (主键)
  6. * @property string $name
  7. * @property integer $price
  8. * @property integer $is_deleted 删除状态
  9. * @property integer $status 状态
  10. * @property mixed $create_at 创建时间
  11. */
  12. class WashGoods extends Model
  13. {
  14. /**
  15. * The connection name for the model.
  16. *
  17. * @var string|null
  18. */
  19. protected $connection = 'mysql';
  20. /**
  21. * The table associated with the model.
  22. *
  23. * @var string
  24. */
  25. protected string $table = "wash_goods";
  26. /**
  27. * The primary key associated with the table.
  28. *
  29. * @var string
  30. */
  31. protected string $primaryKey = "id";
  32. /**
  33. * Indicates if the model should be timestamped.
  34. *
  35. * @var bool
  36. */
  37. public bool $timestamps = false;
  38. public function getPriceAttr($data): int|string
  39. {
  40. if (empty($data)) return 0;
  41. return format_money(($data/100));
  42. }
  43. }