public function index()
 {
     $query = Departamento::query();
     if ($this->request->getQuery('search_id')) {
         $query->andWhere('id = :id:')->bind(['id' => $this->request->getQuery('search_id')]);
     } else {
         if ($this->request->getQuery('search_descricao')) {
             $query->andWhere('descricao ILIKE :descricao:')->bind(['descricao' => "%{$this->request->getQuery('search_descricao')}%"]);
         }
     }
     if ($this->request->getQuery(DefaultParams::ORDER)) {
         $query->order($this->request->getQuery(DefaultParams::ORDER));
     }
     return GetResponse::createResponse($this->request, $query->execute()->toArray());
 }
 public function index()
 {
     $query = DepartamentosFuncionario::query()->columns(['id_funcionario', 'descricao as departamento'])->join('wsGerProj\\Models\\Departamento');
     $binds = [];
     if ($this->request->getQuery('search_id_funcionario')) {
         $query->andWhere('id_funcionario = :id_funcionario:');
         $binds['id_funcionario'] = $this->request->getQuery('search_id_funcionario');
     }
     if ($this->request->getQuery('search_id_departamento')) {
         $query->andWhere('id_departamento = :id_departamento:');
         $binds['id_departamento'] = $this->request->getQuery('search_id_departamento');
     }
     if (count($binds)) {
         $query->bind($binds);
     }
     return GetResponse::createResponse($this->request, $query->execute()->toArray());
 }
 public function index()
 {
     $query = Projeto::query();
     if ($this->request->getQuery('search_id')) {
         $query->andWhere('id = :id:')->bind(['id' => $this->request->getQuery('search_id')]);
     } else {
         $binds = [];
         if ($this->request->getQuery('search_nome')) {
             $query->andWhere('nome ILIKE :nome:');
             $binds['nome'] = "%{$this->request->getQuery('search_nome')}%";
         }
         if ($this->request->getQuery('search_descricao')) {
             $query->andWhere('descricao ILIKE :descricao:');
             $binds['descricao'] = "%{$this->request->getQuery('search_descricao')}%";
         }
         if (count($binds)) {
             $query->bind($binds);
         }
     }
     if ($this->request->getQuery(DefaultParams::ORDER)) {
         $query->order($this->request->getQuery(DefaultParams::ORDER));
     }
     return GetResponse::createResponse($this->request, $query->execute()->toArray());
 }
 public function index()
 {
     $tipos = TipoEndereco::find();
     return GetResponse::createResponse($this->request, $tipos->toArray());
 }