Jak utworzyć kwerendę wielostanowiskową przy użyciu Laravel Eloquent?
Używam konstruktora zapytań Laravel Eloquent i mam zapytanie, gdzie chcęWHERE
klauzula dotycząca wielu warunków. To działa, ale nie jest eleganckie.
Przykład:
$results = User::where('this', '=', 1)
->where('that', '=', 1)
->where('this_too', '=', 1)
->where('that_too', '=', 1)
->where('this_as_well', '=', 1)
->where('that_as_well', '=', 1)
->where('this_one_too', '=', 1)
->where('that_one_too', '=', 1)
->where('this_one_as_well', '=', 1)
->where('that_one_as_well', '=', 1)
->get();
Czy jest lepszy sposób, aby to zrobić, czy powinienem trzymać się tej metody?