Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
duncanmcclean committed Jul 1, 2024
1 parent 54ca2f9 commit 8aaf233
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
6 changes: 1 addition & 5 deletions src/Actions/Publish.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@ public function visibleTo($item)

public function visibleToBulk($items)
{
$allowedOnItems = $items->filter(function ($item) {
return $this->visibleTo($item);
});

return $items->count() === $allowedOnItems->count();
return $items->every(fn ($item) => $this->visibleTo($item));
}

public function authorize($user, $item)
Expand Down
6 changes: 1 addition & 5 deletions src/Actions/Unpublish.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@ public function visibleTo($item)

public function visibleToBulk($items)
{
$allowedOnItems = $items->filter(function ($item) {
return $this->visibleTo($item);
});

return $items->count() === $allowedOnItems->count();
return $items->every(fn ($item) => $this->visibleTo($item));
}

public function authorize($user, $item)
Expand Down

0 comments on commit 8aaf233

Please sign in to comment.