File tree 1 file changed +22
-0
lines changed
1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ Laravel includes a variety of global "helper" PHP functions. Many of these funct
37
37
[ Arr::forget] ( #method-array-forget )
38
38
[ Arr::get] ( #method-array-get )
39
39
[ Arr::has] ( #method-array-has )
40
+ [ Arr::hasAny] ( #method-array-hasany )
40
41
[ Arr::isAssoc] ( #method-array-isassoc )
41
42
[ Arr::last] ( #method-array-last )
42
43
[ Arr::only] ( #method-array-only )
@@ -438,6 +439,27 @@ The `Arr::has` method checks whether a given item or items exists in an array us
438
439
439
440
// false
440
441
442
+ <a name =" method-array-hasany " ></a >
443
+ #### ` Arr::hasAny() ` {#collection-method}
444
+
445
+ The ` Arr::hasAny ` method checks whether any item in a given set exists in an array using "dot" notation:
446
+
447
+ use Illuminate\Support\Arr;
448
+
449
+ $array = ['product' => ['name' => 'Desk', 'price' => 100]];
450
+
451
+ $contains = Arr::hasAny($array, 'product.name');
452
+
453
+ // true
454
+
455
+ $contains = Arr::hasAny($array, ['product.name', 'product.discount']);
456
+
457
+ // true
458
+
459
+ $contains = Arr::hasAny($array, ['category', 'product.discount']);
460
+
461
+ // false
462
+
441
463
<a name =" method-array-isassoc " ></a >
442
464
#### ` Arr::isAssoc() ` {#collection-method}
443
465
You can’t perform that action at this time.
0 commit comments