toArray(); $units = [1, 2, 3, 4, 5]; $categories = ['Vegetable', 'Meat', 'Dairy', 'Beverage', 'Spices', 'Grains', 'Bakery', 'Seafood', 'Fruits', 'Others']; $ingredients = []; for ($i = 1; $i <= 50; $i++) { $unit = $faker->randomElement($units); $category = $faker->randomElement($categories); $supplierId = ! empty($supplierIds) ? $faker->randomElement($supplierIds) : null; $costPerUnit = $faker->randomFloat(2, 10, 500); $stockQty = $faker->randomFloat(2, 5, 500); $lowStock = $faker->randomFloat(2, 1, 10); $ingredients[] = [ 'restaurant_id' => $restaurantId, 'supplier_id' => $supplierId, 'name' => ucfirst($faker->word), 'unit_id' => $unit, 'stock_quantity' => $stockQty, 'cost_per_unit' => $costPerUnit, 'low_stock_alert' => $lowStock, 'last_purchase_price' => $faker->optional()->randomFloat(2, 10, 500), 'last_purchase_date' => $faker->optional()->date(), 'conversion_factor' => $faker->randomFloat(2, 0.5, 2), 'reserved_quantity' => $faker->randomFloat(2, 0, 20), 'wastage_quantity' => $faker->randomFloat(2, 0, 10), 'category' => $category, 'notes' => $faker->optional()->sentence(10), 'status' => $faker->randomElement([0, 1]), 'created_at' => now(), 'updated_at' => now(), ]; } Ingredient::insert($ingredients); $this->command->info('✅ Seeded 50 ingredients successfully.'); } }