Advertisement
Guest User

Untitled

a guest
Apr 27th, 2015
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. class User extends Model {
  2.  
  3. public function scopeFiltros($query, $filtros)
  4. {
  5. if(isset($filtros['cep']))
  6. {
  7. $query->where('cep', '=', $filtros['cep']);
  8. }
  9.  
  10. if(isset($filtros['cidade']))
  11. {
  12. $query->where('cidade', '=', $filtros['cidade']);
  13. }
  14.  
  15. if(isset($filtros['estado']))
  16. {
  17. $query->where('estado', '=', $filtros['estado']);
  18. }
  19.  
  20. return $query;
  21. }
  22. }
  23.  
  24. User::filtros($_GET)->all();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement