mardi 8 septembre 2020

Proper way of using Laravel Collect for creating combination

I am trying to create combination from the below list, but I am not sure how to parse through the results as the results dynamicaly changes each time.

Here is the result I receive through my form,

{"1":["Medium"],"2":["White","Blue"]}

How do I parse the above result to get the possible combination (eg below).

product_combination 
-------------------
Medium-White
Medium-Blue
....
....
Medium
Medium-White-Large

I am using Laravel, I would be later storing the data in the database for reference

I appreciate if you could explain me how to handle such data.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire