'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"); } }