dataRange() ->catchSearch() ->append(['guardians_gender_text', 'gender_text','card_type_text']) ->order($this->aliasField('id'), 'desc') ->paginate(); return $res; } //根据姓名搜索 public function searchNameAttr($query, $value, $data) { return $query->where('name', 'like', '%' . $value . '%'); } public function searchRfidSnAttr($query, $value, $data) { return $query->where('name', 'like', '%' . $value . '%'); } public function getGuardiansGenderTextAttr($value){ $guardians_gender = $this->getData('guardians_gender'); return (new SysDictData())->getValueByCode('GENDER_OPTION', $guardians_gender) ?: ''; } public function getGenderTextAttr($value){ $gender = $this->getData('gender'); return (new SysDictData())->getValueByCode('GENDER_OPTION', $gender) ?: ''; } public function getCardTypeTextAttr($value){ $card_type = $this->getData('card_type'); return (new SysDictData())->getValueByCode('CARD_TYPE_OPTION', $card_type) ?: ''; } public function getGenderAttr($value){ return (string)$value; } public function getGuardiansGenderAttr($value){ return (string)$value; } }