Skip to content

Commit

Permalink
Fix for deleted roles breaking users listing.
Browse files Browse the repository at this point in the history
  • Loading branch information
jesseleite committed Feb 19, 2020
1 parent 85a00a6 commit a87a78b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Fieldtypes/UserRoles.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@ protected function toItemArray($id, $site = null)
return $this->invalidItemArray($id);
}

public function preProcessIndex($data)
{
$roles = collect($data)
->filter(function ($id) {
return Role::exists($id);
})
->values()
->all();

return parent::preProcessIndex($roles);
}

public function getIndexItems($request)
{
return Role::all()->map(function ($role) {
Expand Down

0 comments on commit a87a78b

Please sign in to comment.