File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed
Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -687,6 +687,14 @@ public function setAppends(array $appends): static
687687 return $ this ;
688688 }
689689
690+ /**
691+ * Return whether the accessor attribute has been appended.
692+ */
693+ public function hasAppended (string $ attribute ): bool
694+ {
695+ return in_array ($ attribute , $ this ->appends );
696+ }
697+
690698 /**
691699 * Get the mutated attributes for a given instance.
692700 */
Original file line number Diff line number Diff line change @@ -1516,6 +1516,11 @@ public function testAppendingOfAttributes()
15161516 $ this ->assertEquals ('camelCased ' , $ model ->camelCased );
15171517 $ this ->assertEquals ('StudlyCased ' , $ model ->StudlyCased );
15181518
1519+ $ this ->assertTrue ($ model ->hasAppended ('is_admin ' ));
1520+ $ this ->assertTrue ($ model ->hasAppended ('camelCased ' ));
1521+ $ this ->assertTrue ($ model ->hasAppended ('StudlyCased ' ));
1522+ $ this ->assertFalse ($ model ->hasAppended ('not_appended ' ));
1523+
15191524 $ model ->setHidden (['is_admin ' , 'camelCased ' , 'StudlyCased ' ]);
15201525 $ this ->assertEquals ([], $ model ->toArray ());
15211526
You can’t perform that action at this time.
0 commit comments