examples/RealWorldExample.php
public function syncNewWastageItems(WastageModel $wastage, Collection $products, array $items)
    {
        $this->setWastage($wastage);

        $itemModels = [];

        foreach ($items as $key => $value) {
            $data = $this->buildItemData($key, $value, $products);
            $item = $this->create($data);

            $itemModels[] = $item;
        }

        return $itemModels;
    }
public function syncNewWastageItems(WastageModel $wastage, Collection $products, array $items)
    {
        $this->setWastage($wastage);

        $itemModels = [];

        foreach ($items as $key => $value) {
            $data = $this->buildItemData($key, $value, $products);
            $item = $this->create($data);

            $itemModels[] = $item;
        }

        return $itemModels;
    }
Sync item data for a new wastage.

@param  \REDACTED\Wastage\WastageModel            $wastage
@param  \Illuminate\Database\Eloquent\Collection  $products
@param  array                                     $items    Item input

@return array  Array of WastageItem models