DemandLog.php 721 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace app\common\model;
  3. use think\Model;
  4. class DemandLog extends Model
  5. {
  6. // 设置字段信息
  7. protected $schema = [
  8. 'id' => 'int',
  9. 'workerid' => 'int',
  10. 'demandid' => 'int',
  11. 'gworkerid' => 'int',
  12. 'createtime' => 'int'
  13. ];
  14. // 设置字段自动转换类型
  15. protected $type = [
  16. 'createtime' => 'timestamp:Y-m-d H:i:s'
  17. ];
  18. // 关联Worker
  19. public function worker()
  20. {
  21. return $this->hasOne(Worker::class, "id", "workerid");
  22. }
  23. // 关联Demand
  24. public function demand()
  25. {
  26. return $this->hasOne(Demand::class, "id", "demandid");
  27. }
  28. // 关联Worker
  29. public function gworker()
  30. {
  31. return $this->hasOne(Worker::class, "id", "gworkerid");
  32. }
  33. }