I have this array:
array:43 [▼
"ALFA ROMEO" => array:1 [▼
0 => "145"
]
"AUDI" => array:6 [▼
0 => "A1"
1 => "A3"
2 => "A4"
3 => "A5"
4 => "AUDI 80"
5 => "Q3"
]
"BMW" => array:15 [▼
0 => "116I"
1 => "118I"
2 => "318I"
3 => "318IA"
4 => "320I"
5 => "320IA"
6 => "325I"
7 => "328I"
8 => "330I"
9 => "535I"
10 => "X1"
11 => "X3"
12 => "X5"
13 => "X6"
14 => "Z4"
]
]
I'd like to do this:
Get the key(ALFA ROMEO / AUDI / BMW) and search this key in a table (brands), get the id of this brand and iterate the "ALFA ROMEO" inside array to get the model (145) and insert in a new table called model_car(brand_id, model). And do the same to AUDI, BMW etc.
I know this is easy, but my mind does not work!
Thank you.