File tree 2 files changed +22
-1
lines changed
src/Structures/Collections
2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -4,11 +4,17 @@ All notable changes to this project will be documented in this file.
4
4
5
5
The format is based on [ Keep a Changelog] [ keepachangelog ] and this project adheres to [ Semantic Versioning] [ semver ] .
6
6
7
+ ## v4.21.0
8
+
9
+ ### Added
10
+
11
+ - Add method ` whereInstanceOf ` into ` ArrayCollection `
12
+
7
13
## v4.20.0
8
14
9
15
### Added
10
16
11
- - Add method ` slugifyWithFormat ` into Str
17
+ - Add method ` slugifyWithFormat ` into ` Str `
12
18
13
19
## v4.19.0
14
20
Original file line number Diff line number Diff line change @@ -287,6 +287,21 @@ public function filter(Closure $func = null): static
287
287
return $ this ->createFrom (array_filter ($ this ->elements , $ func , ARRAY_FILTER_USE_BOTH ));
288
288
}
289
289
290
+ public function whereInstanceOf (string |array $ type ): static
291
+ {
292
+ return $ this ->filter (
293
+ static function ($ value ) use ($ type ) {
294
+ foreach ((array )$ type as $ classType ) {
295
+ if ($ value instanceof $ classType ) {
296
+ return true ;
297
+ }
298
+ }
299
+
300
+ return false ;
301
+ }
302
+ );
303
+ }
304
+
290
305
/**
291
306
* {@inheritDoc}
292
307
*
You can’t perform that action at this time.
0 commit comments