File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -545,11 +545,21 @@ public function take(int|string $count): self
545
545
*
546
546
* @throws InvalidRelationshipException
547
547
*/
548
- public function where (string $ property , $ value = true ): self
548
+ public function where (iterable | string $ property , $ value = true ): self
549
549
{
550
- $ this ->wheres [$ property ] = is_a ($ value , LaravelCollection::class)
551
- ? $ value ->toArray ()
552
- : $ value ;
550
+ is_iterable ($ property )
551
+ // Given multiple properties to set, so recursively call self
552
+ ? Collection::wrap ($ property )->each (
553
+ fn ($ v , string $ p ): self => is_numeric ($ p )
554
+ // No value given, so use default value
555
+ ? $ this ->where ($ v , $ value )
556
+ // Pass property & value
557
+ : $ this ->where ($ p , $ v ),
558
+ )
559
+ // Given single property
560
+ : $ this ->wheres [$ property ] = is_a ($ value , LaravelCollection::class)
561
+ ? $ value ->toArray ()
562
+ : $ value ;
553
563
554
564
return $ this ;
555
565
}
You can’t perform that action at this time.
0 commit comments