File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed
src/Structures/Collections Expand file tree Collapse file tree 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.
44
55The format is based on [ Keep a Changelog] [ keepachangelog ] and this project adheres to [ Semantic Versioning] [ semver ] .
66
7+ ## v4.21.0
8+
9+ ### Added
10+
11+ - Add method ` whereInstanceOf ` into ` ArrayCollection `
12+
713## v4.20.0
814
915### Added
1016
11- - Add method ` slugifyWithFormat ` into Str
17+ - Add method ` slugifyWithFormat ` into ` Str `
1218
1319## v4.19.0
1420
Original file line number Diff line number Diff line change @@ -287,6 +287,21 @@ public function filter(Closure $func = null): static
287287 return $ this ->createFrom (array_filter ($ this ->elements , $ func , ARRAY_FILTER_USE_BOTH ));
288288 }
289289
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+
290305 /**
291306 * {@inheritDoc}
292307 *
You can’t perform that action at this time.
0 commit comments