insert([ 'id' => Str::uuid(), 'id_incre' => $i + 1, // Increment id_incre from 1 to 5 'tipe_peti_id' => $this->getRandomId('type_petis'), 'warna' => 'Dummy Warna ' . ($i + 1), 'fix_lot' => 'Dummy Fix Lot ' . ($i + 1), 'packing_no' => rand(1, 100), 'customer_id' => $this->getRandomId('customers'), 'jumlah' => rand(1, 10), 'date_pembuatan' => now(), 'warehouse_id' => $this->getRandomId('m_warehouses'), 'kondisipeti_id' => $this->getRandomId('kondisi_petis'), 'created_at' => now(), 'updated_at' => now(), 'created_by' => 'Seeder', 'updated_by' => 'Seeder', ]); } } /** * Get a random ID from a specific table * * @param string $tableName * @return string|null */ private function getRandomId($tableName) { $record = DB::table($tableName)->inRandomOrder()->first(); return $record ? $record->id : null; } }