We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3bbe0d0 commit 2db3b7fCopy full SHA for 2db3b7f
1 file changed
src/Traits/CollectionUtilities.php
@@ -508,6 +508,16 @@ public function reverse(bool $preserveKeys = false): self
508
return $inst;
509
}
510
511
+
512
+ public function searchWithKey(string $findWithKey, string $matchTo): self
513
+ {
514
+ $inst = clone $this;
515
+ $inst->raw = array_values(array_filter($inst->raw, fn($p) => $p[$findWithKey] === $matchTo))[0] ?? [];
516
+ return $inst;
517
+ }
518
519
520
521
/**
522
* Searches the array for a given value and returns the first corresponding 'key' if
523
* successful to a collection
0 commit comments