|
@@ -23,20 +23,19 @@ class MunicipioController extends AuthController {
|
|
|
|
|
|
if ($idEstado !== "") {
|
|
|
$query->andWhere(["[[Estado]].{{id}}" => $idEstado]);
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- if ($id !== "") {
|
|
|
+ if ($id !== "") {
|
|
|
$query->andWhere(["[[Municipio]].{{id}}" => $id]);
|
|
|
- }
|
|
|
-
|
|
|
- if (!empty($buscar)) {
|
|
|
- $query->andWhere([
|
|
|
- 'or',
|
|
|
- ['ilike', '[[Municipio]].{{nombre}}', $buscar],
|
|
|
- ['ilike', '[[Estado]].{{nombre}}', $buscar],
|
|
|
- ]);
|
|
|
}
|
|
|
|
|
|
+ $query->andWhere([
|
|
|
+ "OR",
|
|
|
+ "f_unaccent({{Municipio}}.[[nombre]]) ilike f_unaccent(:q)",
|
|
|
+ "f_unaccent({{Estado}}.[[nombre]]) ilike f_unaccent(:q)",
|
|
|
+ ])->addParams([':q' => "%{$buscar}%"]);
|
|
|
+ //
|
|
|
+
|
|
|
return new Respuesta($query, $this->limite, $this->pagina, $this->ordenar);
|
|
|
}
|
|
|
|
|
@@ -88,7 +87,6 @@ class MunicipioController extends AuthController {
|
|
|
|
|
|
return (new Respuesta($modelo))
|
|
|
->mensaje("Registro de Municipio guardado con éxito.");
|
|
|
-
|
|
|
} catch (\Exception $e) {
|
|
|
return (new Respuesta())
|
|
|
->esError()
|