Advertisement
Guest User

Untitled

a guest
Aug 21st, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. $prospect = Prospect::select('status_prospect.*', 'prospect.*')
  2. ->join('status_prospect', 'prospect.idstatus_prospect', 'status_prospect.id')
  3. ->where(function ($query){
  4. $query->where('prospect.ativo', '<>', 'E');
  5. $query->where('status_prospect.ativo', '<>', 'E');
  6. })
  7. ->when($filtro, function($query) use ($filtro){
  8. $query->where('prospect.nome', 'like', '%' . $filtro . '%');
  9. $query->orWhere('prospect.telefone1', 'like', '%' . $filtro . '%');
  10. $query->orWhere('prospect.telefone2', 'like', '%' . $filtro . '%');
  11. $query->orWhere('prospect.ramal1', 'like', '%' . $filtro . '%');
  12. $query->orWhere('prospect.ramal2', 'like', '%' . $filtro . '%');
  13. $query->orWhere('prospect.ativo', '=', $filtro);
  14. $query->orWhere('status_prospect.nome', 'like', '%' . $filtro . '%');
  15. })
  16. ->get();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement