Skip to content

Commit

Permalink
Fix memory usage when listing roles increasing over time
Browse files Browse the repository at this point in the history
  • Loading branch information
sydgren committed Dec 10, 2020
1 parent 2ceea13 commit 5748bca
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src-php/Role.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ class Role extends Resource
'name',
];

public static $with = [
'users',
];

/**
* Get the fields displayed by the resource.
*
Expand Down Expand Up @@ -73,7 +69,7 @@ public function fields(Request $request)
->toArray()),

Text::make(__('Users'), function () {
return count($this->users);
return $this->users()->count();
})->onlyOnIndex(),

BelongsToMany::make(__('Users'), 'users', config('novatoolpermissions.userResource', 'App\Nova\User'))
Expand Down

0 comments on commit 5748bca

Please sign in to comment.