Add Order Items

The security and performance of the app should not come in the way of code readability and maintainability.

Items management

We will provide three different API endpoints to the user for order items management. The routes/api.php file can be updated as follows.

<?php
// ...
    Route::prefix('order-items')->group(function () {
        Route::post('/add/{orderId}', [OrderItemController::class, 'add']);
        Route::post('/change-quantity/{orderId}', [OrderItemController::class, 'changeQuantity']);
        Route::post('/remove/{orderId}', [OrderItemController::class, 'remove']);
    });
// ...
  1. First, we will let users add multiple order items by passing an array of menu item IDs and quantities.
  2. The
...