Skip to content

Commit

Permalink
Removing duplicate query on user list table
Browse files Browse the repository at this point in the history
  • Loading branch information
realodix committed Jun 2, 2024
1 parent 3252f9d commit f12e6d5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/Livewire/Table/UserTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@ public function fields(): PowerGridFields
{
return PowerGrid::fields()
->add('name', function (User $user) {
$urlCountTitle = $user->urls()->count().' '.Str::plural('url', $user->urls()->count()).' created';
$urlsCount = $user->urls()->count();
$urlCountTitle = $urlsCount.' '.Str::plural('url', $urlsCount).' created';

return $user->name.' <span title="'.$urlCountTitle.'">('.numberAbbreviate($user->urls()->count()).')</span>';
return $user->name.' <span title="'.$urlCountTitle.'">('.numberAbbreviate($urlsCount).')</span>';
})
->add('email')
->add('created_at_formatted', function (User $user) {
Expand Down

0 comments on commit f12e6d5

Please sign in to comment.