User.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. namespace app\model\user;
  3. use app\extra\basic\Model;
  4. use app\model\cutter\CutterApply;
  5. use app\model\cutter\CutterOrder;
  6. use think\model\relation\HasMany;
  7. use think\model\relation\HasOne;
  8. /**
  9. * 用户
  10. */
  11. class User extends Model
  12. {
  13. /**
  14. * The connection name for the model.
  15. *
  16. * @var string|null
  17. */
  18. protected $connection = 'mysql';
  19. /**
  20. * The table associated with the model.
  21. *
  22. * @var string
  23. */
  24. protected string $table = "user";
  25. /**
  26. * The primary key associated with the table.
  27. *
  28. * @var string
  29. */
  30. protected string $primaryKey = "uid";
  31. /**
  32. * Indicates if the model should be timestamped.
  33. *
  34. * @var bool
  35. */
  36. public bool $timestamps = false;
  37. public function cutterApply(): HasOne
  38. {
  39. return $this->hasOne(CutterApply::class,"uid","uid");
  40. }
  41. public function level(): HasOne
  42. {
  43. return $this->hasOne(UserLevel::class,"id","level");
  44. }
  45. public function cutterOrder(): HasMany
  46. {
  47. return $this->hasMany(CutterOrder::class,"uid","uid");
  48. }
  49. public function brokerage(): HasMany
  50. {
  51. return $this->hasMany(UserBrokerage::class,"uid","uid");
  52. }
  53. }