/** * obtém os registros para exibir no grid */ public function index() { $this->preparar_filtros(); if ($this->filtros->tem_filtro) { $where = " codigo LIKE '%{$this->filtros->filtro_codigo}%' AND\n descricao LIKE '%{$this->filtros->filtro_descricao}%'\n "; } else { $where = WHERE_TODOS_REGISTROS; } $rs = Produto::whereRaw($where)->orderBy($this->filtros->order, $this->filtros->posicao)->paginate($this->total_registros); return view('produtos.produtos_grid')->with('rs', $rs)->with('filtros', $this->filtros); }