12345678910111213141516171819202122232425262728293031323334353637383940 |
- <?php
- namespace app\common\model;
- use think\Model;
- class DemandLog extends Model
- {
- // 设置字段信息
- protected $schema = [
- 'id' => 'int',
- 'workerid' => 'int',
- 'demandid' => 'int',
- 'gworkerid' => 'int',
- 'createtime' => 'int'
- ];
-
- // 设置字段自动转换类型
- protected $type = [
- 'createtime' => 'timestamp:Y-m-d H:i:s'
- ];
-
- // 关联Worker
- public function worker()
- {
- return $this->hasOne(Worker::class, "id", "workerid");
- }
-
- // 关联Demand
- public function demand()
- {
- return $this->hasOne(Demand::class, "id", "demandid");
- }
-
- // 关联Worker
- public function gworker()
- {
- return $this->hasOne(Worker::class, "id", "gworkerid");
- }
-
- }
|