Skip to content

Instantly share code, notes, and snippets.

@matheusdavidson
Created November 26, 2014 22:16
Show Gist options
  • Save matheusdavidson/acbbdf7f16bb27bb1e62 to your computer and use it in GitHub Desktop.
Save matheusdavidson/acbbdf7f16bb27bb1e62 to your computer and use it in GitHub Desktop.
// Filter
if (!empty($filter)) {
$query->where('id', 'LIKE', "%{$filter}%");
$query->orWhere('name', 'LIKE', "%{$filter}%");
$query->orWhere('social_reason', 'LIKE', "%{$filter}%");
$query->orWhere('state_insc', 'LIKE', "%{$filter}%");
$query->orWhere('city_insc', 'LIKE', "%{$filter}%");
$query->orWhere('cpf', 'LIKE', "%{$filter}%");
$query->orWhere('cnpj', 'LIKE', "%{$filter}%");
$query->orWhere('email', 'LIKE', "%{$filter}%");
$query->orWhere('phone', 'LIKE', "%{$filter}%");
$query->orWhere('mobile', 'LIKE', "%{$filter}%");
$query->orWhere('address_cep', 'LIKE', "%{$filter}%");
$query->orWhere('address_district', 'LIKE', "%{$filter}%");
$query->orWhere('address_city', 'LIKE', "%{$filter}%");
$query->orWhere('address_state', 'LIKE', "%{$filter}%");
$query->orWhere('birth', 'LIKE', "%{$filter}%");
$query->orWhere('gender', 'LIKE', "%{$filter}%");
$query->orWhere('obs', 'LIKE', "%{$filter}%");
$query->orWhere('type', 'LIKE', "%{$filter}%");
$query->orWhere('contacts', 'LIKE', "%{$filter}%");
}
// poderia ser no control:
Lib::setFilter(array(colunas,que,serão,filtradas));
//na lib
setFilter =
foreach($column as $col=>val)
col like val
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment