migrate to gtea from bistbucket
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Booking\Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class BookingDatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$this->call([
|
||||
HotelTableSeeder::class,
|
||||
FloorTableSeeder::class,
|
||||
RoomTypeTableSeeder::class,
|
||||
RoomTableSeeder::class,
|
||||
RoomAvailabilityTableSeeder::class,
|
||||
RoomBlockTableSeeder::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Booking\Database\Seeders;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class BookingTableSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
// Sample bookings
|
||||
$bookings = [
|
||||
[
|
||||
'restaurant_id' => 1,
|
||||
'hotel_id' => 1,
|
||||
'customer_id' => 2,
|
||||
'check_in' => Carbon::now()->addDays(2)->format('Y-m-d'),
|
||||
'check_out' => Carbon::now()->addDays(5)->format('Y-m-d'),
|
||||
'check_in_time' => '14:00:00',
|
||||
'check_out_time' => '12:00:00',
|
||||
'total_adults' => 2,
|
||||
'total_children' => 1,
|
||||
'subtotal_amount' => 360.00,
|
||||
'tax_amount' => 36.00,
|
||||
'discount_amount' => 20.00,
|
||||
'total_amount' => 376.00,
|
||||
'payment_status' => 'pending',
|
||||
'payment_method' => 'cash',
|
||||
'channel' => 'website',
|
||||
'status' => 'confirmed',
|
||||
'remarks' => 'VIP customer',
|
||||
'created_at' => Carbon::now(),
|
||||
'updated_at' => Carbon::now(),
|
||||
],
|
||||
[
|
||||
'restaurant_id' => 1,
|
||||
'hotel_id' => 1,
|
||||
'customer_id' => 3,
|
||||
'check_in' => Carbon::now()->addDays(3)->format('Y-m-d'),
|
||||
'check_out' => Carbon::now()->addDays(4)->format('Y-m-d'),
|
||||
'check_in_time' => '15:00:00',
|
||||
'check_out_time' => '11:00:00',
|
||||
'total_adults' => 1,
|
||||
'total_children' => 0,
|
||||
'subtotal_amount' => 120.00,
|
||||
'tax_amount' => 12.00,
|
||||
'discount_amount' => 0,
|
||||
'total_amount' => 132.00,
|
||||
'payment_status' => 'pending',
|
||||
'payment_method' => 'card',
|
||||
'channel' => 'walkin',
|
||||
'status' => 'pending',
|
||||
'remarks' => 'First-time guest',
|
||||
'created_at' => Carbon::now(),
|
||||
'updated_at' => Carbon::now(),
|
||||
],
|
||||
];
|
||||
|
||||
// Insert bookings and get inserted IDs
|
||||
foreach ($bookings as $bookingData) {
|
||||
$bookingId = DB::table('bookings')->insertGetId($bookingData);
|
||||
|
||||
// Sample booking items (rooms)
|
||||
$bookingItems = [
|
||||
[
|
||||
'restaurant_id' => $bookingData['restaurant_id'],
|
||||
'booking_id' => $bookingId,
|
||||
'room_id' => 1,
|
||||
'adults' => 2,
|
||||
'children' => 1,
|
||||
'room_price' => 120.00 * 3, // nights * per-night price
|
||||
'nights' => 3,
|
||||
'tax_amount' => 36.00,
|
||||
'total_amount' => 156.00, // room_price + tax
|
||||
'status' => 'reserved',
|
||||
'created_at' => Carbon::now(),
|
||||
'updated_at' => Carbon::now(),
|
||||
],
|
||||
[
|
||||
'restaurant_id' => $bookingData['restaurant_id'],
|
||||
'booking_id' => $bookingId,
|
||||
'room_id' => 2,
|
||||
'adults' => 0,
|
||||
'children' => 0,
|
||||
'room_price' => 0, // no extra room for first booking
|
||||
'nights' => 0,
|
||||
'tax_amount' => 0,
|
||||
'total_amount' => 0,
|
||||
'status' => 'reserved',
|
||||
'created_at' => Carbon::now(),
|
||||
'updated_at' => Carbon::now(),
|
||||
],
|
||||
];
|
||||
|
||||
DB::table('booking_items')->insert($bookingItems);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Booking\Database\Seeders;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class FloorTableSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$floors = [
|
||||
[
|
||||
'restaurant_id' => 1,
|
||||
'hotel_id' => 1,
|
||||
'name' => 'Lobby',
|
||||
'level' => 0,
|
||||
'status' => 1,
|
||||
'created_at' => Carbon::now(),
|
||||
'updated_at' => Carbon::now(),
|
||||
],
|
||||
[
|
||||
'restaurant_id' => 1,
|
||||
'hotel_id' => 1,
|
||||
'name' => '1st Floor',
|
||||
'level' => 1,
|
||||
'status' => 1,
|
||||
'created_at' => Carbon::now(),
|
||||
'updated_at' => Carbon::now(),
|
||||
],
|
||||
[
|
||||
'restaurant_id' => 1,
|
||||
'hotel_id' => 1,
|
||||
'name' => '2nd Floor',
|
||||
'level' => 2,
|
||||
'status' => 1,
|
||||
'created_at' => Carbon::now(),
|
||||
'updated_at' => Carbon::now(),
|
||||
],
|
||||
[
|
||||
'restaurant_id' => 1,
|
||||
'hotel_id' => 2,
|
||||
'name' => 'Lobby',
|
||||
'level' => 0,
|
||||
'status' => 1,
|
||||
'created_at' => Carbon::now(),
|
||||
'updated_at' => Carbon::now(),
|
||||
],
|
||||
[
|
||||
'restaurant_id' => 1,
|
||||
'hotel_id' => 2,
|
||||
'name' => '1st Floor',
|
||||
'level' => 1,
|
||||
'status' => 1,
|
||||
'created_at' => Carbon::now(),
|
||||
'updated_at' => Carbon::now(),
|
||||
],
|
||||
[
|
||||
'restaurant_id' => 1,
|
||||
'hotel_id' => 3,
|
||||
'name' => 'Lobby',
|
||||
'level' => 0,
|
||||
'status' => 1,
|
||||
'created_at' => Carbon::now(),
|
||||
'updated_at' => Carbon::now(),
|
||||
],
|
||||
[
|
||||
'restaurant_id' => 1,
|
||||
'hotel_id' => 3,
|
||||
'name' => '1st Floor',
|
||||
'level' => 1,
|
||||
'status' => 1,
|
||||
'created_at' => Carbon::now(),
|
||||
'updated_at' => Carbon::now(),
|
||||
],
|
||||
];
|
||||
|
||||
DB::table('floors')->insert($floors);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Booking\Database\Seeders;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class HotelTableSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$hotels = [
|
||||
[
|
||||
'restaurant_id' => 1,
|
||||
'name' => 'Sunrise Hotel',
|
||||
'location' => 'Dhaka, Bangladesh',
|
||||
'email' => 'info@sunrisehotel.com',
|
||||
'phone' => '+880123456789',
|
||||
'description' => 'A luxurious hotel with stunning sunrise views.',
|
||||
'latitude' => 23.8103,
|
||||
'longitude' => 90.4125,
|
||||
'check_in_time' => '14:00',
|
||||
'check_out_time' => '12:00',
|
||||
'status' => 1,
|
||||
'created_at' => Carbon::now(),
|
||||
'updated_at' => Carbon::now(),
|
||||
],
|
||||
[
|
||||
'restaurant_id' => 1,
|
||||
'name' => 'Moonlight Inn',
|
||||
'location' => 'Chittagong, Bangladesh',
|
||||
'email' => 'contact@moonlightinn.com',
|
||||
'phone' => '+880987654321',
|
||||
'description' => 'Comfortable stays under the moonlight.',
|
||||
'latitude' => 22.3569,
|
||||
'longitude' => 91.7832,
|
||||
'check_in_time' => '14:00',
|
||||
'check_out_time' => '12:00',
|
||||
'status' => 1,
|
||||
'created_at' => Carbon::now(),
|
||||
'updated_at' => Carbon::now(),
|
||||
],
|
||||
[
|
||||
'restaurant_id' => 1,
|
||||
'name' => 'Seaside Resort',
|
||||
'location' => 'Cox\'s Bazar, Bangladesh',
|
||||
'email' => 'info@seasideresort.com',
|
||||
'phone' => '+880192837465',
|
||||
'description' => 'Relax by the beach with scenic views.',
|
||||
'latitude' => 21.4272,
|
||||
'longitude' => 92.0058,
|
||||
'check_in_time' => '14:00',
|
||||
'check_out_time' => '12:00',
|
||||
'status' => 1,
|
||||
'created_at' => Carbon::now(),
|
||||
'updated_at' => Carbon::now(),
|
||||
],
|
||||
];
|
||||
|
||||
DB::table('hotels')->insert($hotels);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Booking\Database\Seeders;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class RoomBlockTableSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$blocks = [
|
||||
[
|
||||
'restaurant_id' => 1,
|
||||
'hotel_id' => 1,
|
||||
'room_id' => 1,
|
||||
'start_date' => Carbon::now()->addDays(2)->format('Y-m-d'),
|
||||
'end_date' => Carbon::now()->addDays(3)->format('Y-m-d'),
|
||||
'start_time' => null,
|
||||
'end_time' => null,
|
||||
'block_type' => 'maintenance',
|
||||
'blocked_inventory' => 2,
|
||||
'priority' => 1,
|
||||
'reason' => 'AC maintenance',
|
||||
'auto_release' => true,
|
||||
'created_by' => 1, // admin user id
|
||||
'status' => 1,
|
||||
'created_at' => Carbon::now(),
|
||||
'updated_at' => Carbon::now(),
|
||||
],
|
||||
[
|
||||
'restaurant_id' => 1,
|
||||
'hotel_id' => 1,
|
||||
'room_id' => 2,
|
||||
'start_date' => Carbon::now()->addDays(1)->format('Y-m-d'),
|
||||
'end_date' => Carbon::now()->addDays(1)->format('Y-m-d'),
|
||||
'start_time' => '12:00:00',
|
||||
'end_time' => '18:00:00',
|
||||
'block_type' => 'deep_clean',
|
||||
'blocked_inventory' => 1,
|
||||
'priority' => 2,
|
||||
'reason' => 'Daily deep cleaning',
|
||||
'auto_release' => true,
|
||||
'created_by' => 1,
|
||||
'status' => 1,
|
||||
'created_at' => Carbon::now(),
|
||||
'updated_at' => Carbon::now(),
|
||||
],
|
||||
];
|
||||
|
||||
DB::table('room_blocks')->insert($blocks);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Booking\Database\Seeders;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class RoomTableSeeder extends Seeder
|
||||
{
|
||||
public function run(): void
|
||||
{
|
||||
$roomTypes = [
|
||||
['id' => 1, 'name' => 'Deluxe Room', 'price_min' => 150, 'price_max' => 220],
|
||||
['id' => 2, 'name' => 'Superior Room', 'price_min' => 130, 'price_max' => 190],
|
||||
['id' => 3, 'name' => 'Premier Room', 'price_min' => 200, 'price_max' => 260],
|
||||
['id' => 4, 'name' => 'Executive Room', 'price_min' => 250, 'price_max' => 320],
|
||||
['id' => 5, 'name' => 'Family Room', 'price_min' => 180, 'price_max' => 240],
|
||||
['id' => 6, 'name' => 'Suite', 'price_min' => 350, 'price_max' => 500],
|
||||
];
|
||||
|
||||
$views = ['City View', 'Garden View', 'Pool View', 'Marina View', 'Skyline View'];
|
||||
$rooms = [];
|
||||
$imagePool = range(1, 46); // images 1–46
|
||||
|
||||
for ($i = 1; $i <= 20; $i++) {
|
||||
|
||||
$type = $roomTypes[array_rand($roomTypes)];
|
||||
|
||||
$image = $imagePool[array_rand($imagePool)].'.jpg';
|
||||
$banner = $imagePool[array_rand($imagePool)].'.jpg';
|
||||
|
||||
// Random gallery 6–8 images
|
||||
shuffle($imagePool);
|
||||
$galleryImages = array_slice($imagePool, 0, rand(6, 8));
|
||||
$galleryImages = array_map(fn ($img) => $img.'.jpg', $galleryImages);
|
||||
|
||||
$roomNumber = 100 + $i;
|
||||
$typeSlug = strtolower(str_replace(' ', '-', $type['name']));
|
||||
|
||||
$regular = rand($type['price_min'], $type['price_max']);
|
||||
$offer = $regular - rand(10, 30);
|
||||
|
||||
$rooms[] = [
|
||||
'restaurant_id' => 1,
|
||||
'hotel_id' => 1,
|
||||
'floor_id' => rand(1, 6),
|
||||
'room_type_id' => $type['id'],
|
||||
|
||||
'room_number' => $roomNumber,
|
||||
'room_code' => strtoupper(substr($typeSlug, 0, 3)).$roomNumber,
|
||||
|
||||
'max_adults' => rand(2, 4),
|
||||
'max_children' => rand(0, 2),
|
||||
|
||||
'has_balcony' => rand(0, 1),
|
||||
'has_bathtub' => rand(0, 1),
|
||||
|
||||
'view_type' => $views[array_rand($views)],
|
||||
'slug' => $roomNumber.'-'.$typeSlug,
|
||||
|
||||
'image' => $image,
|
||||
'banner_image' => $banner,
|
||||
'gallery_images' => json_encode($galleryImages),
|
||||
|
||||
'description' => $type['name'].' with modern amenities, designed for comfort and a premium Singapore hotel experience.',
|
||||
|
||||
'regular_price' => $regular,
|
||||
'offer_price' => $offer,
|
||||
|
||||
'is_clean' => true,
|
||||
'is_available' => true,
|
||||
'status' => 1,
|
||||
|
||||
'created_at' => Carbon::now(),
|
||||
'updated_at' => Carbon::now(),
|
||||
];
|
||||
}
|
||||
|
||||
DB::table('rooms')->insert($rooms);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Booking\Database\Seeders;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class RoomTypeTableSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$roomTypes = [
|
||||
// Hotel 1
|
||||
[
|
||||
'restaurant_id' => 1,
|
||||
'hotel_id' => 1,
|
||||
'name' => 'Deluxe Room',
|
||||
'capacity' => 2,
|
||||
'beds' => 1,
|
||||
'bed_type' => 'Queen',
|
||||
'has_ac' => true,
|
||||
'has_wifi' => true,
|
||||
'has_breakfast' => true,
|
||||
'is_refundable' => true,
|
||||
'base_price' => 120.00,
|
||||
'weekend_price' => 150.00,
|
||||
'extra_guest_price' => 30.00,
|
||||
'description' => 'Spacious deluxe room with modern amenities.',
|
||||
'status' => 1,
|
||||
'created_at' => Carbon::now(),
|
||||
'updated_at' => Carbon::now(),
|
||||
],
|
||||
[
|
||||
'restaurant_id' => 1,
|
||||
'hotel_id' => 1,
|
||||
'name' => 'Standard Room',
|
||||
'capacity' => 2,
|
||||
'beds' => 1,
|
||||
'bed_type' => 'Twin',
|
||||
'has_ac' => true,
|
||||
'has_wifi' => true,
|
||||
'has_breakfast' => false,
|
||||
'is_refundable' => true,
|
||||
'base_price' => 80.00,
|
||||
'weekend_price' => 100.00,
|
||||
'extra_guest_price' => 20.00,
|
||||
'description' => 'Cozy standard room for a comfortable stay.',
|
||||
'status' => 1,
|
||||
'created_at' => Carbon::now(),
|
||||
'updated_at' => Carbon::now(),
|
||||
],
|
||||
// Hotel 2
|
||||
[
|
||||
'restaurant_id' => 1,
|
||||
'hotel_id' => 2,
|
||||
'name' => 'Suite Room',
|
||||
'capacity' => 4,
|
||||
'beds' => 2,
|
||||
'bed_type' => 'King',
|
||||
'has_ac' => true,
|
||||
'has_wifi' => true,
|
||||
'has_breakfast' => true,
|
||||
'is_refundable' => true,
|
||||
'base_price' => 200.00,
|
||||
'weekend_price' => 250.00,
|
||||
'extra_guest_price' => 50.00,
|
||||
'description' => 'Luxury suite with separate living area.',
|
||||
'status' => 1,
|
||||
'created_at' => Carbon::now(),
|
||||
'updated_at' => Carbon::now(),
|
||||
],
|
||||
[
|
||||
'restaurant_id' => 1,
|
||||
'hotel_id' => 2,
|
||||
'name' => 'Standard Room',
|
||||
'capacity' => 2,
|
||||
'beds' => 1,
|
||||
'bed_type' => 'Queen',
|
||||
'has_ac' => true,
|
||||
'has_wifi' => true,
|
||||
'has_breakfast' => false,
|
||||
'is_refundable' => true,
|
||||
'base_price' => 90.00,
|
||||
'weekend_price' => 120.00,
|
||||
'extra_guest_price' => 25.00,
|
||||
'description' => 'Comfortable room suitable for short stays.',
|
||||
'status' => 1,
|
||||
'created_at' => Carbon::now(),
|
||||
'updated_at' => Carbon::now(),
|
||||
],
|
||||
// Hotel 3
|
||||
[
|
||||
'restaurant_id' => 1,
|
||||
'hotel_id' => 3,
|
||||
'name' => 'Seaside Deluxe',
|
||||
'capacity' => 3,
|
||||
'beds' => 2,
|
||||
'bed_type' => 'Queen',
|
||||
'has_ac' => true,
|
||||
'has_wifi' => true,
|
||||
'has_breakfast' => true,
|
||||
'is_refundable' => true,
|
||||
'base_price' => 150.00,
|
||||
'weekend_price' => 180.00,
|
||||
'extra_guest_price' => 35.00,
|
||||
'description' => 'Deluxe room with sea view.',
|
||||
'status' => 1,
|
||||
'created_at' => Carbon::now(),
|
||||
'updated_at' => Carbon::now(),
|
||||
],
|
||||
[
|
||||
'restaurant_id' => 1,
|
||||
'hotel_id' => 3,
|
||||
'name' => 'Seaside Standard',
|
||||
'capacity' => 2,
|
||||
'beds' => 1,
|
||||
'bed_type' => 'Twin',
|
||||
'has_ac' => true,
|
||||
'has_wifi' => true,
|
||||
'has_breakfast' => false,
|
||||
'is_refundable' => true,
|
||||
'base_price' => 100.00,
|
||||
'weekend_price' => 130.00,
|
||||
'extra_guest_price' => 25.00,
|
||||
'description' => 'Affordable standard room with a partial sea view.',
|
||||
'status' => 1,
|
||||
'created_at' => Carbon::now(),
|
||||
'updated_at' => Carbon::now(),
|
||||
],
|
||||
];
|
||||
|
||||
DB::table('room_types')->insert($roomTypes);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user