@@ -21,7 +21,6 @@ easy-to-use API for syncing your menu and managing orders.
2121 - [ Mark Order as Ready] ( #mark-order-as-ready )
2222 - [ Mark Order as Delivered] ( #mark-order-as-delivered )
2323 - [ Confirm Preorder] ( #confirm-preorder )
24- - ** [ Example of Syncing Menu] ( #example-of-syncing-menu ) **
2524- [ Contribution Guidelines] ( #contribution-guidelines )
2625- [ Changelog] ( #changelog )
2726- [ License] ( #license )
@@ -85,191 +84,193 @@ use Spatie\LaravelData\DataCollection;
8584
8685// Example Translations for Category
8786$categoryNameTranslation = new DataCollection([
88- new TranslationData( lang: 'en', value: 'Beverages'),
89- new TranslationData( lang: 'fr', value: 'Boissons')
87+ TranslationData::from([' lang' => 'en', ' value' => 'Beverages'] ),
88+ TranslationData::from([' lang' => 'fr', ' value' => 'Boissons'] )
9089]);
9190
9291// Example Translations for Subcategory
9392$subCategoryNameTranslation = new DataCollection([
94- new TranslationData( lang: 'en', value: 'Hot Drinks'),
95- new TranslationData( lang: 'fr', value: 'Boissons Chaudes')
93+ TranslationData::from([' lang' => 'en', ' value' => 'Hot Drinks'] ),
94+ TranslationData::from([' lang' => 'fr', ' value' => 'Boissons Chaudes'] )
9695]);
9796
9897// Example Translations for Item
9998$itemNameTranslation = new DataCollection([
100- new TranslationData( lang: 'en', value: 'Espresso'),
101- new TranslationData( lang: 'fr', value: 'Espresso')
99+ TranslationData::from([' lang' => 'en', ' value' => 'Espresso'] ),
100+ TranslationData::from([' lang' => 'fr', ' value' => 'Espresso'] )
102101]);
103102
104103$itemDescriptionTranslation = new DataCollection([
105- new TranslationData( lang: 'en', value: 'Rich and bold espresso coffee'),
106- new TranslationData( lang: 'fr', value: 'Café espresso riche et audacieux')
104+ TranslationData::from([' lang' => 'en', ' value' => 'Rich and bold espresso coffee'] ),
105+ TranslationData::from([' lang' => 'fr', ' value' => 'Café espresso riche et audacieux'] )
107106]);
108107
109108// Example Translations for Options
110109$optionNameTranslation = new DataCollection([
111- new TranslationData( lang: 'en', value: 'Milk Type'),
112- new TranslationData( lang: 'fr', value: 'Type de Lait')
110+ TranslationData::from([' lang' => 'en', ' value' => 'Milk Type'] ),
111+ TranslationData::from([' lang' => 'fr', ' value' => 'Type de Lait'] )
113112]);
114113
115114$optionValueNameTranslation1 = new DataCollection([
116- new TranslationData( lang: 'en', value: 'Whole Milk'),
117- new TranslationData( lang: 'fr', value: 'Lait entier')
115+ TranslationData::from([' lang' => 'en', ' value' => 'Whole Milk'] ),
116+ TranslationData::from([' lang' => 'fr', ' value' => 'Lait entier'] )
118117]);
119118
120119$optionValueNameTranslation2 = new DataCollection([
121- new TranslationData( lang: 'en', value: 'Soy Milk'),
122- new TranslationData( lang: 'fr', value: 'Lait de soja')
120+ TranslationData::from([' lang' => 'en', ' value' => 'Soy Milk'] ),
121+ TranslationData::from([' lang' => 'fr', ' value' => 'Lait de soja'] )
123122]);
124123
125124// Example Sub-option Value
126125$subOptionValueNameTranslation = new DataCollection([
127- new TranslationData( lang: 'en', value: 'Vanilla Syrup'),
128- new TranslationData( lang: 'fr', value: 'Sirop de vanille')
126+ TranslationData::from([' lang' => 'en', ' value' => 'Vanilla Syrup'] ),
127+ TranslationData::from([' lang' => 'fr', ' value' => 'Sirop de vanille'] )
129128]);
130129
131130// Example Nutrition Information
132- $nutritionInformation = new NutritionInformationData(
133- serving_size: 'per_100_ml',
134- nutrition_values: new NutritionValuesData(
135- energy_kcal: new NutrientData( unit: 'kcal', value: 5 ),
136- energy_kj: new NutrientData( unit: 'kj', value: 20 ),
137- fats: new NutrientData( unit: 'g', value: 0.1),
138- saturated_fats: new NutrientData( unit: 'g', value: 0.05),
139- mono_unsaturated_fats: new NutrientData( unit: 'g', value: 0.01),
140- poly_unsaturated_fats: new NutrientData( unit: 'g', value: 0.01),
141- carbohydrate: new NutrientData( unit: 'g', value: 0.5),
142- sugar: new NutrientData( unit: 'g', value: 0.1),
143- starch: new NutrientData( unit: 'g', value: 0.2),
144- polyols: new NutrientData( unit: 'g', value: 0.0),
145- protein: new NutrientData( unit: 'g', value: 0.2),
146- salt: new NutrientData( unit: 'g', value: 0.01),
147- sodium: new NutrientData( unit: 'mg', value: 5 ),
148- fibres: new NutrientData( unit: 'g', value: 0.1),
149- vitamin_c: new NutrientData( unit: 'mg', value: 0.0),
150- potassium: new NutrientData( unit: 'mg', value: 80 ),
151- calcium: new NutrientData( unit: 'mg', value: 10 ),
152- magnesium: new NutrientData( unit: 'mg', value: 2 ),
153- chloride: new NutrientData( unit: 'mg', value: 5 ),
154- fluoride: new NutrientData( unit: 'mg', value: 0.0)
155- )
156- );
131+ $nutritionInformation = NutritionInformationData::from([
132+ ' serving_size' => 'per_100_ml',
133+ ' nutrition_values' => NutritionValuesData::from([
134+ ' energy_kcal' => NutrientData::from([' unit' => 'kcal', ' value' => 5] ),
135+ ' energy_kj' => NutrientData::from([' unit' => 'kj', ' value' => 20] ),
136+ ' fats' => NutrientData::from([' unit' => 'g', ' value' => 0.1] ),
137+ ' saturated_fats' => NutrientData::from([' unit' => 'g', ' value' => 0.05] ),
138+ ' mono_unsaturated_fats' => NutrientData::from([' unit' => 'g', ' value' => 0.01] ),
139+ ' poly_unsaturated_fats' => NutrientData::from([' unit' => 'g', ' value' => 0.01] ),
140+ ' carbohydrate' => NutrientData::from([' unit' => 'g', ' value' => 0.5] ),
141+ ' sugar' => NutrientData::from([' unit' => 'g', ' value' => 0.1] ),
142+ ' starch' => NutrientData::from([' unit' => 'g', ' value' => 0.2] ),
143+ ' polyols' => NutrientData::from([' unit' => 'g', ' value' => 0.0] ),
144+ ' protein' => NutrientData::from([' unit' => 'g', ' value' => 0.2] ),
145+ ' salt' => NutrientData::from([' unit' => 'g', ' value' => 0.01] ),
146+ ' sodium' => NutrientData::from([' unit' => 'mg', ' value' => 5] ),
147+ ' fibres' => NutrientData::from([' unit' => 'g', ' value' => 0.1] ),
148+ ' vitamin_c' => NutrientData::from([' unit' => 'mg', ' value' => 0.0] ),
149+ ' potassium' => NutrientData::from([' unit' => 'mg', ' value' => 80] ),
150+ ' calcium' => NutrientData::from([' unit' => 'mg', ' value' => 10] ),
151+ ' magnesium' => NutrientData::from([' unit' => 'mg', ' value' => 2] ),
152+ ' chloride' => NutrientData::from([' unit' => 'mg', ' value' => 5] ),
153+ ' fluoride' => NutrientData::from([' unit' => 'mg', ' value' => 0.0] )
154+ ] )
155+ ] );
157156
158157// Example Product Information
159- $productInformation = new ProductInformationData(
160- ingredients: new DataCollection([
161- new TranslationData( lang: 'en', value: 'Water, Coffee Beans'),
162- new TranslationData( lang: 'fr', value: 'Eau, Grains de café')
158+ $productInformation = ProductInformationData::from([
159+ ' ingredients' => new DataCollection([
160+ TranslationData::from([' lang' => 'en', ' value' => 'Water, Coffee Beans'] ),
161+ TranslationData::from([' lang' => 'fr', ' value' => 'Eau, Grains de café'] )
163162 ]),
164- additives: new DataCollection([
165- new TranslationData( lang: 'en', value: 'None'),
166- new TranslationData( lang: 'fr', value: 'Aucun')
163+ ' additives' => new DataCollection([
164+ TranslationData::from([' lang' => 'en', ' value' => 'None'] ),
165+ TranslationData::from([' lang' => 'fr', ' value' => 'Aucun'] )
167166 ]),
168- nutrition_facts: new DataCollection([
169- new TranslationData( lang: 'en', value: 'Low calories'),
170- new TranslationData( lang: 'fr', value: 'Faible en calories')
167+ ' nutrition_facts' => new DataCollection([
168+ TranslationData::from([' lang' => 'en', ' value' => 'Low calories'] ),
169+ TranslationData::from([' lang' => 'fr', ' value' => 'Faible en calories'] )
171170 ]),
172- nutrition_information: $nutritionInformation,
173- allergens: new DataCollection([
174- new TranslationData(lang: 'en', value: 'None'),
175- new TranslationData(lang: 'fr', value: 'Aucun')
171+ 'nutrition_information' => $
172+
173+ nutritionInformation,
174+ 'allergens' => new DataCollection([
175+ TranslationData::from(['lang' => 'en', 'value' => 'None']),
176+ TranslationData::from(['lang' => 'fr', 'value' => 'Aucun'])
176177 ]),
177- producer_information: new DataCollection([
178- new TranslationData( lang: 'en', value: 'Local Roastery'),
179- new TranslationData( lang: 'fr', value: 'Torréfacteur local')
178+ ' producer_information' => new DataCollection([
179+ TranslationData::from([' lang' => 'en', ' value' => 'Local Roastery'] ),
180+ TranslationData::from([' lang' => 'fr', ' value' => 'Torréfacteur local'] )
180181 ])
181- );
182+ ] );
182183
183184// Example Option with Sub-option Values
184- $optionValue1 = new OptionValueData(
185- name: $optionValueNameTranslation1,
186- selection_range: new SelectionRangeData( min: 0, max: 1 ),
187- price: 0.50,
188- enabled: true,
189- default: true,
190- external_data: 'option-value-1',
191- sub_option_values: new DataCollection([
192- new SubOptionValueData(
193- name: $subOptionValueNameTranslation,
194- selection_range: new SelectionRangeData( min: 0, max: 1 ),
195- price: 0.20,
196- enabled: true,
197- default: false,
198- external_data: 'sub-option-value-1'
199- )
185+ $optionValue1 = OptionValueData::from([
186+ ' name' => $optionValueNameTranslation1,
187+ ' selection_range' => SelectionRangeData::from([' min' => 0, ' max' => 1] ),
188+ ' price' => 0.50,
189+ ' enabled' => true,
190+ ' default' => true,
191+ ' external_data' => 'option-value-1',
192+ ' sub_option_values' => new DataCollection([
193+ SubOptionValueData::from([
194+ ' name' => $subOptionValueNameTranslation,
195+ ' selection_range' => SelectionRangeData::from([' min' => 0, ' max' => 1] ),
196+ ' price' => 0.20,
197+ ' enabled' => true,
198+ ' default' => false,
199+ ' external_data' => 'sub-option-value-1'
200+ ] )
200201 ])
201- );
202-
203- $optionValue2 = new OptionValueData(
204- name: $optionValueNameTranslation2,
205- selection_range: new SelectionRangeData( min: 0, max: 1 ),
206- price: 0.60,
207- enabled: true,
208- default: false,
209- external_data: 'option-value-2',
210- sub_option_values: null
211- );
212-
213- $option = new OptionData(
214- name: $optionNameTranslation,
215- type: 'SingleChoice',
216- selection_range: new SelectionRangeData( min: 1, max: 1 ),
217- external_data: 'option-1',
218- values: new DataCollection([$optionValue1, $optionValue2])
219- );
202+ ] );
203+
204+ $optionValue2 = OptionValueData::from([
205+ ' name' => $optionValueNameTranslation2,
206+ ' selection_range' => SelectionRangeData::from([' min' => 0, ' max' => 1] ),
207+ ' price' => 0.60,
208+ ' enabled' => true,
209+ ' default' => false,
210+ ' external_data' => 'option-value-2',
211+ ' sub_option_values' => null
212+ ] );
213+
214+ $option = OptionData::from([
215+ ' name' => $optionNameTranslation,
216+ ' type' => 'SingleChoice',
217+ ' selection_range' => SelectionRangeData::from([' min' => 1, ' max' => 1] ),
218+ ' external_data' => 'option-1',
219+ ' values' => new DataCollection([$optionValue1, $optionValue2])
220+ ] );
220221
221222// Example Item
222- $item = new ItemData(
223- name: $itemNameTranslation,
224- description: $itemDescriptionTranslation,
225- image_url: 'https://example.com/espresso.jpg',
226- price: 2.99,
227- sales_tax_percentage: 0.07,
228- alcohol_percentage: null,
229- caffeine_content: new CaffeineContentData( serving_size: 'per_100_ml', value: 212.0),
230- weekly_availability: new DataCollection([
231- new WeeklyAvailabilityData(
232- opening_day: 'MONDAY',
233- opening_time: '08:00',
234- closing_day: 'MONDAY',
235- closing_time: '20:00'
236- )
223+ $item = ItemData::from([
224+ ' name' => $itemNameTranslation,
225+ ' description' => $itemDescriptionTranslation,
226+ ' image_url' => 'https://example.com/espresso.jpg',
227+ ' price' => 2.99,
228+ ' sales_tax_percentage' => 0.07,
229+ ' alcohol_percentage' => null,
230+ ' caffeine_content' => CaffeineContentData::from([' serving_size' => 'per_100_ml', ' value' => 212.0] ),
231+ ' weekly_availability' => new DataCollection([
232+ WeeklyAvailabilityData::from([
233+ ' opening_day' => 'MONDAY',
234+ ' opening_time' => '08:00',
235+ ' closing_day' => 'MONDAY',
236+ ' closing_time' => '20:00'
237+ ] )
237238 ]),
238- weekly_visibility: new DataCollection([
239- new WeeklyVisibilityData(
240- opening_day: 'MONDAY',
241- opening_time: '08:00',
242- closing_day: 'MONDAY',
243- closing_time: '20:00'
244- )
239+ ' weekly_visibility' => new DataCollection([
240+ WeeklyVisibilityData::from([
241+ ' opening_day' => 'MONDAY',
242+ ' opening_time' => '08:00',
243+ ' closing_day' => 'MONDAY',
244+ ' closing_time' => '20:00'
245+ ] )
245246 ]),
246- enabled: true,
247- delivery_methods: ['takeaway', 'homedelivery'],
248- options: new DataCollection([$option]),
249- external_data: 'item-espresso-001',
250- product_information: $productInformation
251- );
247+ ' enabled' => true,
248+ ' delivery_methods' => ['takeaway', 'homedelivery'],
249+ ' options' => new DataCollection([$option]),
250+ ' external_data' => 'item-espresso-001',
251+ ' product_information' => $productInformation
252+ ] );
252253
253254// Example Subcategory
254- $subcategory = new SubcategoryData(
255- name: $subCategoryNameTranslation,
256- description: null,
257- items: new DataCollection([$item])
258- );
255+ $subcategory = SubcategoryData::from([
256+ ' name' => $subCategoryNameTranslation,
257+ ' description' => null,
258+ ' items' => new DataCollection([$item])
259+ ] );
259260
260261// Example Category
261- $category = new CategoryData(
262- name: $categoryNameTranslation,
263- description: null,
264- subcategories: new DataCollection([$subcategory])
265- );
262+ $category = CategoryData::from([
263+ ' name' => $categoryNameTranslation,
264+ ' description' => null,
265+ ' subcategories' => new DataCollection([$subcategory])
266+ ] );
266267
267268// Example Menu
268- $menu = new MenuData(
269- currency: 'USD',
270- primary_language: 'en',
271- categories: new DataCollection([$category])
272- );
269+ $menu = MenuData::from([
270+ ' currency' => 'USD',
271+ ' primary_language' => 'en',
272+ ' categories' => new DataCollection([$category])
273+ ] );
273274
274275$response = WoltService::syncMenu($menuData);
275276```
@@ -359,7 +360,7 @@ For a detailed history of changes, see [releases](https://github.com/Bored-Progr
359360
360361## License
361362
362- This project is licensed under the [ MIT license] ( https://github.com/Bored-Programmers/wolt/blob/main /LICENSE.md) .
363+ This project is licensed under the [ MIT license] ( /LICENSE.md ) .
363364
364365## Contact Information
365366
0 commit comments