Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $prospect = Prospect::select('status_prospect.*', 'prospect.*')
- ->join('status_prospect', 'prospect.idstatus_prospect', 'status_prospect.id')
- ->where(function ($query){
- $query->where('prospect.ativo', '<>', 'E');
- $query->where('status_prospect.ativo', '<>', 'E');
- })
- ->when($filtro, function($query) use ($filtro){
- $query->where('prospect.nome', 'like', '%' . $filtro . '%');
- $query->orWhere('prospect.telefone1', 'like', '%' . $filtro . '%');
- $query->orWhere('prospect.telefone2', 'like', '%' . $filtro . '%');
- $query->orWhere('prospect.ramal1', 'like', '%' . $filtro . '%');
- $query->orWhere('prospect.ramal2', 'like', '%' . $filtro . '%');
- $query->orWhere('prospect.ativo', '=', $filtro);
- $query->orWhere('status_prospect.nome', 'like', '%' . $filtro . '%');
- })
- ->get();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement