@@ -82,39 +82,39 @@ public function map($model): array
8282 $ attributes = $ model ->only ($ this ->allowedAttributes ());
8383
8484 foreach ($ attributes as $ attribute => $ value ) {
85- $ attributes [$ attribute ] = $ this ->formatValue ($ attribute , $ value );
85+ $ attributes [$ attribute ] = $ this ->formatValue ($ model , $ attribute , $ value );
8686 }
8787
8888 return array_values ($ attributes );
8989 }
9090
91- public function isAdminModel (string $ attribute , mixed $ value ): bool
91+ public function isAdminModel ($ model , string $ attribute , mixed $ value ): bool
9292 {
9393 return $ value instanceof Model && method_exists ($ value , 'getAdminLinkNameAttribute ' );
9494 }
9595
96- public function isAdminModelCollection (string $ attribute , mixed $ value ): bool
96+ public function isAdminModelCollection ($ model , string $ attribute , mixed $ value ): bool
9797 {
9898 if (! $ value instanceof Collection) {
9999 return false ;
100100 }
101101
102102 foreach ($ value as $ item ) {
103- if (! $ this ->isAdminModel ($ attribute , $ item )) {
103+ if (! $ this ->isAdminModel ($ model , $ attribute , $ item )) {
104104 return false ;
105105 }
106106 }
107107
108108 return true ;
109109 }
110110
111- public function formatValue (string $ attribute , mixed $ value ): mixed
111+ public function formatValue ($ model , string $ attribute , mixed $ value ): mixed
112112 {
113113 if ($ value instanceof BackedEnum) {
114114 return $ value ->getEnumLabel ();
115- } elseif ($ this ->isAdminModelCollection ($ attribute , $ value )) {
115+ } elseif ($ this ->isAdminModelCollection ($ model , $ attribute , $ value )) {
116116 return $ value ->implode ('admin_link_name ' , ', ' );
117- } elseif ($ this ->isAdminModel ($ attribute , $ value )) {
117+ } elseif ($ this ->isAdminModel ($ model , $ attribute , $ value )) {
118118 return $ value ->admin_link_name ;
119119 } elseif (is_bool ($ value )) {
120120 return $ value ? 'True ' : 'False ' ;
0 commit comments