File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -44,3 +44,43 @@ class UsersImport implements WithMappedCells, ToModel
44
44
::: warning
45
8000
45
This concern is not meant to map ** columns** , only specific ** cell** reference are allowed.
46
46
:::
47
+
48
+ ## Multi-demensional Mapping
49
+
50
+ In case you have repeating data in your table, e. g. a spreadsheet looking like this:
51
+
52
+ | Team 1 | | Team 2| |
53
+ | -| -| -| -|
54
+ | Max | 2 | Peter | 3 |
55
+ | Annie | 0 | Alex | 1 |
56
+
57
+ you are also able to define cell coordinates in a nested array:
58
+
59
+ ``` php
60
+ public function mapping(): array
61
+ {
62
+ return [
63
+ 'team1' => [
64
+ [
65
+ 'name' => 'A2',
66
+ 'score' => 'B2',
67
+ ],
68
+ [
69
+ 'name' => 'A3',
70
+ 'score' => 'B3',
71
+ ],
72
+ ],
73
+ 'team2' => [
74
+ [
75
+ 'name' => 'C2',
76
+ 'score' => 'D2',
77
+ ],
78
+ [
79
+ 'name' => 'C3',
80
+ 'score' => 'D3',
81
+ ],
82
+ ],
83
+ ];
84
+ }```
85
+
86
+ Note that an array of the same form will be returned.
You can’t perform that action at this time.
0 commit comments