File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77 {{ $slot } }
88 @elseif ($isAdminModel () )
99 {!! $value -> admin_link ! !}
10+ @elseif ($isAdminModelCollection () )
11+ {!! $value -> implode (' admin_link' , trans (' forms::strings.table_array_separator' )) ! !}
1012 @else
1113 @if ($isStatusEnum () )
1214 <x-forms::status :framework =" $framework" :color =" $value->getColor()" :label =" $getEnumLabel()" />
Original file line number Diff line number Diff line change @@ -16,6 +16,8 @@ class="{{ $inlineEntryClass }}"
1616 {{ $slot } }
1717 @elseif ($isAdminModel () )
1818 {!! $value -> admin_link ! !}
19+ @elseif ($isAdminModelCollection () )
20+ {!! $value -> implode (' admin_link' , trans (' forms::strings.table_array_separator' )) ! !}
1921 @else
2022 @if ($isStatusEnum () )
2123 <x-forms::status :framework =" $framework" :color =" $value->getColor()" :label =" $getEnumLabel()" />
Original file line number Diff line number Diff line change 77 {{ $slot } }
88 @elseif ($isAdminModel () )
99 {!! $value -> admin_link ! !}
10+ @elseif ($isAdminModelCollection () )
11+ {!! $value -> implode (' admin_link' , trans (' forms::strings.table_array_separator' )) ! !}
1012 @else
1113 @if ($isStatusEnum () )
1214 <x-forms::status :framework =" $framework" :color =" $value->getColor()" :label =" $getEnumLabel()" />
Original file line number Diff line number Diff line change @@ -16,6 +16,8 @@ class="{{ $inlineEntryClass }}"
1616 {{ $slot } }
1717 @elseif ($isAdminModel () )
1818 {!! $value -> admin_link ! !}
19+ @elseif ($isAdminModelCollection () )
20+ {!! $value -> implode (' admin_link' , trans (' forms::strings.table_array_separator' )) ! !}
1921 @else
2022 @if ($isStatusEnum () )
2123 <x-forms::status :framework =" $framework" :color =" $value->getColor()" :label =" $getEnumLabel()" />
Original file line number Diff line number Diff line change 44
55use BackedEnum ;
66use Illuminate \Database \Eloquent \Model ;
7+ use Illuminate \Support \Collection ;
78
89trait FormatsValues
910{
@@ -23,7 +24,27 @@ public function isStatusEnum(): bool
2324
2425 public function isAdminModel (): bool
2526 {
26- return $ this ->value instanceof Model && method_exists ($ this ->value , 'getAdminLinkAttribute ' );
27+ return $ this ->checkIfIsAdminModel ($ this ->value );
28+ }
29+
30+ public function checkIfIsAdminModel (mixed $ value ): bool
31+ {
32+ return $ value instanceof Model && method_exists ($ value , 'getAdminLinkAttribute ' );
33+ }
34+
35+ public function isAdminModelCollection (): bool
36+ {
37+ if (! $ this ->value instanceof Collection) {
38+ return false ;
39+ }
40+
41+ foreach ($ this ->value as $ item ) {
42+ if (! $ this ->checkIfIsAdminModel ($ item )) {
43+ return false ;
44+ }
45+ }
46+
47+ return true ;
2748 }
2849
2950 public function formatValue ()
You can’t perform that action at this time.
0 commit comments