From e36427dc518a38f18743933df2dc7bb1fa93a1ec Mon Sep 17 00:00:00 2001 From: Milwad <98118400+milwad-dev@users.noreply.github.com> Date: Sat, 24 May 2025 09:07:27 +0330 Subject: [PATCH 1/2] add `Arr::hasAll` method to helpers --- helpers.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/helpers.md b/helpers.md index 819322de99..cb6285b4a6 100644 --- a/helpers.md +++ b/helpers.md @@ -55,6 +55,7 @@ Laravel includes a variety of global "helper" PHP functions. Many of these funct [Arr::from](#method-array-from) [Arr::get](#method-array-get) [Arr::has](#method-array-has) +[Arr::hasAll](#method-array-hasall) [Arr::hasAny](#method-array-hasany) [Arr::integer](#method-array-integer) [Arr::isAssoc](#method-array-isassoc) @@ -557,6 +558,21 @@ $contains = Arr::has($array, ['product.price', 'product.discount']); // false ``` + +#### `Arr::hasAll()` {.collection-method} + +The `Arr::hasAll` method checks if all of the specified keys exist in the given array using "dot" notation: + +```php +use Illuminate\Support\Arr; + +$array = ['name' => 'Taylor', 'language' => 'php']; + +Arr::hasAll($array, ['name']); // true +Arr::hasAll($array, ['name', 'language']); // true +Arr::hasAll($array, ['name', 'ide']); // false +``` + #### `Arr::hasAny()` {.collection-method} From 5ba662c1e88814223c12d0b87051e81549644966 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Mon, 26 May 2025 10:23:39 -0700 Subject: [PATCH 2/2] Update helpers.md --- helpers.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helpers.md b/helpers.md index cb6285b4a6..a797121cdd 100644 --- a/helpers.md +++ b/helpers.md @@ -561,7 +561,7 @@ $contains = Arr::has($array, ['product.price', 'product.discount']); #### `Arr::hasAll()` {.collection-method} -The `Arr::hasAll` method checks if all of the specified keys exist in the given array using "dot" notation: +The `Arr::hasAll` method determines if all of the specified keys exist in the given array using "dot" notation: ```php use Illuminate\Support\Arr;