Skip to content

Commit

Permalink
Merge pull request #9 from pinkary-project/feat/where-any
Browse files Browse the repository at this point in the history
Replace `orWhere` with `whereAny`
  • Loading branch information
nunomaduro authored Mar 20, 2024
2 parents 5b25119 + 407074f commit 59aef53
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/Livewire/Users/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ public function render(): View
*/
private function usersByQuery(): Collection
{
return User::where('name', 'like', "%{$this->query}%")
->orWhere('username', 'like', "%{$this->query}%")
return User::query()
->whereAny(['name', 'username'], 'like', "%{$this->query}%")
->withCount('questionsReceived')
->orderBy('questions_received_count', 'desc')->limit(10)->get();
}
Expand Down

0 comments on commit 59aef53

Please sign in to comment.