Advertisement
Guest User

Untitled

a guest
Jan 24th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. public function search()
  2. {
  3. $ramais = $this->paginate($this->Ramais);
  4.  
  5. if ($this->request->is('post')) {
  6. $search = null;
  7. if (isset($this->request->data['search'])) {
  8. $search = $this->request->data['search'];
  9. }
  10.  
  11. $ramal = $this->Ramais->find('all',
  12. [
  13. 'contain' => ['Setores'],
  14.  
  15. 'conditions'=>['OR'=>
  16. [
  17. 'Ramais.name LIKE'=>'%'.$search.'%',
  18. 'Ramais.ramal LIKE'=>'%'.$search.'%',
  19. 'Setores.name LIKE'=>'%'.$search.'%'
  20. ]
  21. ]
  22. ]
  23. );
  24.  
  25. //debug($ramal); exit();
  26.  
  27. $this->set(compact('ramais', 'ramal', 'setor'));
  28. $this->set('_serialize', ['ramais'], ['setor']);
  29. $this->render('index');
  30.  
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement