53 lines
1.7 KiB
PHP
53 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace Modules\Booking\Database\Seeders;
|
|
|
|
use Carbon\Carbon;
|
|
use Illuminate\Database\Seeder;
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
class RoomAvailabilityTableSeeder extends Seeder
|
|
{
|
|
/**
|
|
* Run the database seeds.
|
|
*/
|
|
public function run(): void
|
|
{
|
|
$availabilities = [];
|
|
// Example: generate availability for next 7 days for two rooms
|
|
$roomIds = [1, 2]; // Room IDs from your rooms table
|
|
$hotelId = 1;
|
|
$restaurantId = 1;
|
|
|
|
for ($i = 0; $i < 7; $i++) {
|
|
$date = Carbon::now()->addDays($i)->format('Y-m-d');
|
|
foreach ($roomIds as $roomId) {
|
|
$availabilities[] = [
|
|
'restaurant_id' => $restaurantId,
|
|
'hotel_id' => $hotelId,
|
|
'room_id' => $roomId,
|
|
'total_inventory' => 5,
|
|
'available_inventory' => rand(1, 5),
|
|
'date' => $date,
|
|
'is_available' => true,
|
|
'is_closed_to_arrival' => false,
|
|
'is_closed_to_departure' => false,
|
|
'base_price' => rand(80, 150),
|
|
'extra_adult_price' => 20,
|
|
'extra_child_price' => 10,
|
|
'min_stay' => 1,
|
|
'max_stay' => 10,
|
|
'blocked_by_booking_id' => null,
|
|
'block_type' => 'none',
|
|
'note' => null,
|
|
'status' => 1,
|
|
'created_at' => Carbon::now(),
|
|
'updated_at' => Carbon::now(),
|
|
];
|
|
}
|
|
}
|
|
|
|
DB::table('room_availabilities')->insert($availabilities);
|
|
}
|
|
}
|