<?php

namespace Database\Seeders;

use App\Models\RawMaterial;
use App\Models\RawMaterialPrice;
use Illuminate\Database\Seeder;

class RawMaterialPriceSeeder extends Seeder
{
    public function run(): void
    {
        RawMaterial::query()
            ->whereDoesntHave('prices')
            ->each(function (RawMaterial $rawMaterial): void {
                RawMaterialPrice::factory()
                    ->count(2)
                    ->create([
                        'raw_material_id' => $rawMaterial->id,
                    ]);
            });
    }
}
