You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> {note} If the callback never returns `false`, the `takeWhile` method will return all items in the collection.
2006
+
1962
2007
<aname="method-tap"></a>
1963
2008
#### `tap()` {#collection-method}
1964
2009
@@ -2151,33 +2196,6 @@ Alias for the [`whenNotEmpty`](#method-whennotempty) method.
2151
2196
2152
2197
Alias for the [`whenEmpty`](#method-whenempty) method.
2153
2198
2154
-
<aname="method-until"></a>
2155
-
#### `until()` {#collection-method}
2156
-
2157
-
The `until` method returns items in the collection until the given value is found:
2158
-
2159
-
$collection = collect([1, 2, 3, 4]);
2160
-
2161
-
$subset = $collection->until(3);
2162
-
2163
-
$subset->all();
2164
-
2165
-
// [1, 2]
2166
-
2167
-
You may also pass a callback to the `until` method to perform your own logic. The callback should return `true` when the `until` method should stop.
2168
-
2169
-
$collection = collect([1, 2, 3, 4]);
2170
-
2171
-
$subset = $collection->until(function ($item) {
2172
-
return $item >= 3;
2173
-
});
2174
-
2175
-
$subset->all();
2176
-
2177
-
// [1, 2]
2178
-
2179
-
If the given value is not found or callback does not return `true`, the `until` method will return all items in the collection.
2180
-
2181
2199
<aname="method-unwrap"></a>
2182
2200
#### `unwrap()` {#collection-method}
2183
2201
@@ -2580,7 +2598,7 @@ The `zip` method merges together the values of the given array with the values o
2580
2598
<aname="higher-order-messages"></a>
2581
2599
## Higher Order Messages
2582
2600
2583
-
Collections also provide support for "higher order messages", which are short-cuts for performing common actions on collections. The collection methods that provide higher order messages are: [`average`](#method-average), [`avg`](#method-avg), [`contains`](#method-contains), [`each`](#method-each), [`every`](#method-every), [`filter`](#method-filter), [`first`](#method-first), [`flatMap`](#method-flatmap), [`groupBy`](#method-groupby), [`keyBy`](#method-keyby), [`map`](#method-map), [`max`](#method-max), [`min`](#method-min), [`partition`](#method-partition), [`reject`](#method-reject), [`some`](#method-some), [`sortBy`](#method-sortby), [`sortByDesc`](#method-sortbydesc), [`sum`](#method-sum),[`unique`](#method-unique), and [`until`](#method-until).
2601
+
Collections also provide support for "higher order messages", which are short-cuts for performing common actions on collections. The collection methods that provide higher order messages are: [`average`](#method-average), [`avg`](#method-avg), [`contains`](#method-contains), [`each`](#method-each), [`every`](#method-every), [`filter`](#method-filter), [`first`](#method-first), [`flatMap`](#method-flatmap), [`groupBy`](#method-groupby), [`keyBy`](#method-keyby), [`map`](#method-map), [`max`](#method-max), [`min`](#method-min), [`partition`](#method-partition), [`reject`](#method-reject), [`some`](#method-some), [`sortBy`](#method-sortby), [`sortByDesc`](#method-sortbydesc), [`sum`](#method-sum)[`takeUntil`](#method-takeuntil), [`takeWhile`](#method-takewhile)and [`unique`](#method-unique).
2584
2602
2585
2603
Each higher order message can be accessed as a dynamic property on a collection instance. For instance, let's use the `each` higher order message to call a method on each object within a collection:
0 commit comments