'int', 'userid' => 'int', 'workerid' => 'int', 'agentid' => 'int', 'title' => 'string', 'avatar' => 'string', 'mobile' => 'string', 'province' => 'string', 'city' => 'string', 'district' => 'string', 'town' => 'string', 'village' => 'string', 'region' => 'string', 'createtime' => 'int', 'status' => 'tinyint', ]; // 设置字段自动转换类型 protected $type = [ 'createtime' => 'timestamp:Y-m-d H:i:s', ]; public function getStatusTextAttr($value, $data) { $status = [1 => '待审核', 2 => '审核通过', 3 => '审核拒绝']; return $status[$data['status']]; } // 关联Worker public function worker() { return $this->hasOne(Worker::class, "id", "workerid"); } // 关联Agent public function agent() { return $this->hasOne(Agent::class, "id", "agentid"); } }