Skip to content

Commit 1ea3db0

Browse files
committed
wip
1 parent 0bad022 commit 1ea3db0

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

helpers.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ Laravel includes a variety of global "helper" PHP functions. Many of these funct
4646
[Arr::crossJoin](#method-array-crossjoin)
4747
[Arr::divide](#method-array-divide)
4848
[Arr::dot](#method-array-dot)
49+
[Arr::every](#method-array-every)
4950
[Arr::except](#method-array-except)
5051
[Arr::exists](#method-array-exists)
5152
[Arr::first](#method-array-first)
@@ -79,6 +80,7 @@ Laravel includes a variety of global "helper" PHP functions. Many of these funct
7980
[Arr::set](#method-array-set)
8081
[Arr::shuffle](#method-array-shuffle)
8182
[Arr::sole](#method-array-sole)
83+
[Arr::some](#method-array-some)
8284
[Arr::sort](#method-array-sort)
8385
[Arr::sortDesc](#method-array-sort-desc)
8486
[Arr::sortRecursive](#method-array-sort-recursive)
@@ -389,6 +391,25 @@ $flattened = Arr::dot($array);
389391
// ['products.desk.price' => 100]
390392
```
391393

394+
<a name="method-array-every"></a>
395+
#### `Arr::every()` {.collection-method}
396+
397+
The `Arr::every` method ensures that all values in the array pass a given truth test:
398+
399+
```php
400+
use Illuminate\Support\Arr;
401+
402+
$array = [1, 2, 3];
403+
404+
Arr::every($array, fn ($i) => $i > 0);
405+
406+
// true
407+
408+
Arr::every($array, fn ($i) => $i > 2);
409+
410+
// false
411+
```
412+
392413
<a name="method-array-except"></a>
393414
#### `Arr::except()` {.collection-method}
394415

@@ -1063,6 +1084,21 @@ $value = Arr::sole($array, fn (string $value) => $value === 'Desk');
10631084
// 'Desk'
10641085
```
10651086

1087+
<a name="method-array-some"></a>
1088+
#### `Arr::some()` {.collection-method}
1089+
1090+
The `Arr::some` method ensures that at least one of the values in the array passes a given truth test:
1091+
1092+
```php
1093+
use Illuminate\Support\Arr;
1094+
1095+
$array = [1, 2, 3];
1096+
1097+
Arr::some($array, fn ($i) => $i > 2);
1098+
1099+
// true
1100+
```
1101+
10661102
<a name="method-array-sort"></a>
10671103
#### `Arr::sort()` {.collection-method}
10681104

0 commit comments

Comments
 (0)