dataRange() ->catchSearch() ->append(['license_plate']) ->order($this->aliasField($field), $order) ->paginate(); return $res; } /** * 获取车牌号码 */ public function getLicensePlateAttr($value) { $vehicle_id = $this->getData('vehicle_id'); return (new Vehicle())->where('id',$vehicle_id)->value('license_plate'); } /** * 根据车牌号码搜索 */ public function searchLicensePlateAttr($query,$value) { $vehicle_id = (new Vehicle())->where('license_plate',trim($value))->value('id'); return $query->where('vehicle_id',$vehicle_id); } /** * 根据处理结果搜索 */ public function searchResultAttr($query,$value) { return $query->where('result',$value); } }