Skip to content

Commit

Permalink
Add AbstractCollection::find()
Browse files Browse the repository at this point in the history
  • Loading branch information
giuscris committed Oct 24, 2024
1 parent 8d2325b commit 351ae93
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions formwork/src/Data/AbstractCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,14 @@ public function some(callable $callback): bool
return Arr::some($this->data, $callback);
}

/**
* Find the first item in the collection for which the given callback returns `true`
*/
public function find(callable $callback): mixed
{
return Arr::find($this->data, $callback);
}

/**
* Clone the collection instance
*/
Expand Down

0 comments on commit 351ae93

Please sign in to comment.