File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
packages/Webkul/DataGrid/src/Exports Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,10 @@ public function map(mixed $record): array
47
47
$ index = $ column ->getIndex ();
48
48
$ value = $ record ->{$ index };
49
49
50
- if (in_array ($ index , ['emails ' , 'contact_numbers ' ]) && is_string ($ value )) {
50
+ if (
51
+ in_array ($ index , ['emails ' , 'contact_numbers ' ])
52
+ && is_string ($ value )
53
+ ) {
51
54
return $ this ->extractValuesFromJson ($ value );
52
55
}
53
56
@@ -61,11 +64,13 @@ public function map(mixed $record): array
61
64
*/
62
65
protected function extractValuesFromJson (string $ json ): string
63
66
{
64
- $ decoded = json_decode ($ json , true );
67
+ $ items = json_decode ($ json , true );
65
68
66
- if (json_last_error () === JSON_ERROR_NONE
67
- && is_array ($ decoded )) {
68
- return collect ($ decoded )->pluck ('value ' )->implode (', ' );
69
+ if (
70
+ json_last_error () === JSON_ERROR_NONE
71
+ && is_array ($ items )
72
+ ) {
73
+ return collect ($ items )->map (fn ($ item ) => "{$ item ['value ' ]} ( {$ item ['label ' ]}) " )->implode (', ' );
69
74
}
70
75
71
76
return $ json ;
You can’t perform that action at this time.
0 commit comments