'int', 'userid' => 'int', 'wtype' => 'tinyint', 'title' => 'string', 'ftitle' => 'string', 'tilpic' => 'string', 'realname' => 'string', 'mobile' => 'string', 'weixin' => 'string', 'latitude' => 'float', 'longitude' => 'float', 'province' => 'string', 'city' => 'string', 'district' => 'string', 'address' => 'string', 'picone' => 'string', 'pictwo' => 'string', 'picthr' => 'string', 'details' => 'string', 'priority' => 'int', 'remark' => 'string', 'status' => 'tinyint', 'createtime' => 'int' ]; // 设置字段自动转换类型 protected $type = [ 'createtime' => 'timestamp:Y-m-d H:i:s' ]; public function getWtypeTextAttr($value,$data) { $wtype = [1=>'普通公司',2=>'派遣公司']; return $wtype[$data['wtype']]; } public function getStatusTextAttr($value,$data) { $status = [1=>'待审核',2=>'未通过',3=>'被禁用',4=>'升级审核',5=>'正常中']; return $status[$data['status']]; } // 关联User public function muser() { return $this->hasOne(User::class, "id", "userid"); } // 关联Agent public function agent() { return $this->hasMany(Agent::class, "workerid", "id"); } // 关联Comjobs public function comjobs() { return $this->hasMany(Comjobs::class, "workerid", "id"); } // 关联Demand public function demand() { return $this->hasMany(Demand::class, "workerid", "id"); } }