public function indexAction() { try { $this->view->departaments = Departments::find(['order' => 'id']); } catch (Exception $exc) { $this->flash->error($e->getMessage()); } }
/** * Index department */ public function indexAction() { try { $this->view->departments = Departments::find(); $this->view->pesquisa = ''; if ($this->request->isPost()) { $departments = $this->request->getPost('departments', 'string'); $search = "(UPPER(title) LIKE UPPER('%" . $departments . "%') OR UPPER(cc) LIKE UPPER('%" . $departments . "%'))"; $this->view->departments = Departments::find($search); $this->view->pesquisa = $this->request->getPost('departments'); } } catch (Exception $exc) { $this->flash->error($e->getMessage()); } }