File tree 2 files changed +32
-0
lines changed
2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -521,6 +521,22 @@ public function makeVisible($attributes)
521
521
return $ this ->each ->makeVisible ($ attributes );
522
522
}
523
523
524
+ /**
525
+ * Set the visible attributes across the entire collection.
526
+ */
527
+ public function setVisible (array $ visible ): static
528
+ {
529
+ return $ this ->each ->setVisible ($ visible );
530
+ }
531
+
532
+ /**
533
+ * Set the hidden attributes across the entire collection.
534
+ */
535
+ public function setHidden (array $ hidden ): static
536
+ {
537
+ return $ this ->each ->setHidden ($ hidden );
538
+ }
539
+
524
540
/**
525
541
* Append an attribute across the entire collection.
526
542
*
Original file line number Diff line number Diff line change @@ -456,6 +456,22 @@ public function testMakeHiddenAddsHiddenOnEntireCollection()
456
456
$ this ->assertEquals (['hidden ' , 'visible ' ], $ c [0 ]->getHidden ());
457
457
}
458
458
459
+ public function testSetVisibleReplacesVisibleOnEntireCollection ()
460
+ {
461
+ $ c = new Collection ([new TestEloquentCollectionModel ()]);
462
+ $ c = $ c ->setVisible (['hidden ' ]);
463
+
464
+ $ this ->assertEquals (['hidden ' ], $ c [0 ]->getVisible ());
465
+ }
466
+
467
+ public function testSetHiddenReplacesHiddenOnEntireCollection ()
468
+ {
469
+ $ c = new Collection ([new TestEloquentCollectionModel ()]);
470
+ $ c = $ c ->setHidden (['visible ' ]);
471
+
472
+ $ this ->assertEquals (['visible ' ], $ c [0 ]->getHidden ());
473
+ }
474
+
459
475
public function testMakeVisibleRemovesHiddenFromEntireCollection ()
460
476
{
461
477
$ c = new Collection ([new TestEloquentCollectionModel ()]);
You can’t perform that action at this time.
0 commit comments