// +---------------------------------------------------------------------- namespace app\matchmaker\model; use think\Model; class MatchmakerUserModel extends Model { protected $type = [ 'family' => 'array', ]; public function matchmaker() { return $this->hasOne(MatchmakerModel::class,'id','matchmaker_id'); } public function getSexTextAttr($value, $data) { $sex = ['保密', '男', '女']; return $sex[$data['sex']]; } }