mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-04-29 06:51:30 -05:00
fix: user search n+1
- eager load group relation
This commit is contained in:
@@ -50,6 +50,7 @@ class UserSearch extends Component
|
||||
{
|
||||
return view('livewire.user-search', [
|
||||
'users' => User::query()
|
||||
->with('group')
|
||||
->when($this->searchTerm, function ($query) {
|
||||
return $query->where('username', 'LIKE', '%'.$this->searchTerm.'%')->orWhere('email', 'LIKE', '%'.$this->searchTerm.'%');
|
||||
})
|
||||
|
||||
@@ -60,10 +60,6 @@
|
||||
<td>
|
||||
<span class="badge-user text-bold">
|
||||
{{ $user->username }}
|
||||
@if ($user->warnings_count > 0)
|
||||
<i class="{{ config('other.font-awesome') }} fa-exclamation-circle text-orange" aria-hidden="true"
|
||||
data-toggle="tooltip" data-original-title="@lang('common.active-warning')"></i>
|
||||
@endif
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
|
||||
Reference in New Issue
Block a user