truncate(); DB::table('reservation_unavailables')->truncate(); // Seed reservations foreach (range(1, 10) as $i) { $restaurantId = $restaurantIds[array_rand($restaurantIds)]; $tableId = $tableIds[array_rand($tableIds)]; $customerId = $customerIds[array_rand($customerIds)]; $date = Carbon::now()->addDays(rand(0, 5))->toDateString(); $startTime = Carbon::createFromTime(rand(10, 20), [0, 30][rand(0, 1)]); $endTime = (clone $startTime)->addHours(2); DB::table('reservations')->insert([ 'restaurant_id' => $restaurantId, 'table_id' => $tableId, 'customer_id' => $customerId, 'reservation_date' => $date, 'start_time' => $startTime->format('H:i:s'), 'end_time' => $endTime->format('H:i:s'), 'people_count' => rand(2, 8), 'status' => collect(['booked', 'free', 'upcoming', 'cancelled'])->random(), 'note' => fake()->sentence(), 'created_at' => now(), 'updated_at' => now(), ]); } // Seed unavailable times foreach (range(1, 5) as $i) { $restaurantId = $restaurantIds[array_rand($restaurantIds)]; $tableId = $tableIds[array_rand($tableIds)]; $date = Carbon::now()->addDays(rand(0, 5))->toDateString(); $startTime = Carbon::createFromTime(rand(10, 22), [0, 30][rand(0, 1)]); $endTime = (clone $startTime)->addHours(rand(1, 3)); DB::table('reservation_unavailables')->insert([ 'restaurant_id' => $restaurantId, 'table_id' => $tableId, 'date' => $date, 'start_time' => $startTime->format('H:i:s'), 'end_time' => $endTime->format('H:i:s'), 'reason' => fake()->sentence(), 'created_at' => now(), 'updated_at' => now(), ]); } } }