dataRange() ->catchSearch() ->append(['pos_spot_text','pre_spot_text']) ->order($this->aliasField('id'), 'desc') ->paginate(); return $res; } //根据name搜索 public function searchNameAttr($query, $value, $data) { return $query->where('name', 'like', '%' . $value . '%'); } public function getPosSpotTextAttr($value){ $value=$this->getData('pos_spot'); return Db::table('stuck_point')->where('id',$value)->value('name'); } public function getPreSpotTextAttr($value){ $value=$this->getData('pre_spot'); return Db::table('stuck_point')->where('id',$value)->value('name'); } public function getRetrogradeStatAttr($value){ return $value?true:false; } public function getOverSpeedStatAttr($value){ return $value?true:false; } }