<?php namespace Database\Seeders; use App\Enums\OrderStatus; use App\Models\Invoice; use App\Models\Order; use Illuminate\Database\Seeder; class InvoiceSeeder extends Seeder { /** * Run the database seeds. */ public function run(): void { foreach (Order::where('status', OrderStatus::INVOICED) as $order) { Invoice::factory()->for($order)->create(); } } }