WashType.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. namespace app\model\wash;
  3. use app\extra\basic\Model;
  4. use think\model\relation\HasOne;
  5. /**
  6. * @property integer $id (主键)
  7. * @property integer $store_id
  8. * @property integer $agent_id
  9. * @property string $name
  10. * @property integer $status 状态
  11. * @property mixed $create_at 创建时间
  12. */
  13. class WashType extends Model
  14. {
  15. /**
  16. * The connection name for the model.
  17. *
  18. * @var string|null
  19. */
  20. protected $connection = 'mysql';
  21. /**
  22. * The table associated with the model.
  23. *
  24. * @var string
  25. */
  26. protected string $table = "wash_type";
  27. /**
  28. * The primary key associated with the table.
  29. *
  30. * @var string
  31. */
  32. protected string $primaryKey = "id";
  33. /**
  34. * Indicates if the model should be timestamped.
  35. *
  36. * @var bool
  37. */
  38. public bool $timestamps = false;
  39. public function getPriceAttr($data): int|string
  40. {
  41. if (empty($data)) return 0;
  42. return format_money(($data/100));
  43. }
  44. public function agent(): HasOne
  45. {
  46. return $this->hasOne("app\model\saas\SaasAgent", "agent_id", "agent_id");
  47. }
  48. public function store(): HasOne
  49. {
  50. return $this->hasOne("app\model\saas\SaasStore", "store_id", "store_id");
  51. }
  52. }