RRobotAutoOrderModel.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Model;
  4. /**
  5. * 充电站点订单自动补充任务
  6. */
  7. class RRobotAutoOrderModel extends Model
  8. {
  9. /**
  10. * The connection name for the model.
  11. */
  12. protected ?string $connection = 'robot';
  13. /**
  14. * The table associated with the model.
  15. */
  16. protected ?string $table = 'r_robot_auto_order';
  17. public bool $timestamps = true;
  18. /**
  19. * The name of the "created at" column.
  20. *
  21. * @var null|string
  22. */
  23. public const CREATED_AT = 'create_time';
  24. /**
  25. * The name of the "updated at" column.
  26. *
  27. * @var null|string
  28. */
  29. public const UPDATED_AT = 'update_time';
  30. /**
  31. * The attributes that are mass assignable.
  32. */
  33. protected array $fillable = [];
  34. /**
  35. * The attributes that should be cast to native types.
  36. */
  37. protected array $casts = [];
  38. //对应机器人
  39. public function robot(): \Hyperf\Database\Model\Relations\HasOne
  40. {
  41. return $this->hasOne(RRobotModel::class, 'id', 'robot_id')->where('del_flag', 0);
  42. }
  43. //对应站点
  44. public function site(): \Hyperf\Database\Model\Relations\HasOne
  45. {
  46. return $this->hasOne(RRobotModel::class, 'id', 'site_id')->where('del_flag', 0);
  47. }
  48. //对应站点单价
  49. public function price(): \Hyperf\Database\Model\Relations\HasMany
  50. {
  51. return $this->hasMany(RSitePriceModel::class, 'site_id', 'site_id')->where('del_flag', 0);
  52. }
  53. }