problema ruta papelformato

This commit is contained in:
2024-10-14 18:19:41 +02:00
parent 52303e9185
commit 668d0d79e6
5 changed files with 41 additions and 16 deletions

View File

@ -260,4 +260,25 @@ class Papelformato extends \App\Controllers\BaseResourceController {
}
}
public function getSelect2()
{
if ($this->request->isAJAX()) {
$query = $this->model->builder()->select(
[
"id",
"nombre as name"
]
)->where("deleted_at", null);
if ($this->request->getGet("q")) {
$query->groupStart()
->orLike("clientes.nombre", $this->request->getGet("q"))
->groupEnd();
}
return $this->response->setJSON($query->get()->getResultObject());
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
}