<?php

namespace Database\Seeders;

use App\Models\Cutting;
use App\Models\CuttingResult;
use Illuminate\Database\Seeder;

class CuttingResultSeeder extends Seeder
{
    public function run(): void
    {
        $cutting = Cutting::query()->first();

        if ($cutting === null) {
            CuttingResult::factory()->count(3)->create();

            return;
        }

        CuttingResult::factory()
            ->count(2)
            ->create([
                'cutting_id' => $cutting->id,
            ]);
    }
}
