migrate to gtea from bistbucket

This commit is contained in:
2026-03-15 17:08:23 +07:00
commit 129ca2260c
3716 changed files with 566316 additions and 0 deletions

View File

@@ -0,0 +1,93 @@
<?php
namespace Modules\Booking\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Modules\Authentication\Models\User;
use Modules\Restaurant\Models\Customer;
class Booking extends Model
{
protected $fillable = [
'restaurant_id',
'hotel_id',
'customer_id',
'check_in',
'check_out',
'check_in_time',
'check_out_time',
'total_adults',
'total_children',
'subtotal_amount',
'tax_amount',
'discount_amount',
'total_amount',
'payment_status',
'payment_method',
'channel',
'status',
'canceled_at',
'canceled_by',
'remarks',
'created_at',
'updated_at',
'deleted_at',
];
/**
* Casts
*/
protected $casts = [
'restaurant_id' => 'integer',
'hotel_id' => 'integer',
'customer_id' => 'integer',
'check_in' => 'date',
'check_out' => 'date',
'check_in_time' => 'datetime:H:i',
'check_out_time' => 'datetime:H:i',
'total_adults' => 'integer',
'total_children' => 'integer',
'subtotal_amount' => 'decimal:2',
'tax_amount' => 'decimal:2',
'discount_amount' => 'decimal:2',
'total_amount' => 'decimal:2',
'canceled_at' => 'datetime',
'canceled_by' => 'integer',
];
public const TABLE_NAME = 'bookings';
protected $table = self::TABLE_NAME;
public function hotel(): BelongsTo
{
return $this->belongsTo(Hotel::class)->select('id', 'name');
}
public function customer(): BelongsTo
{
return $this->belongsTo(Customer::class)->select('id', 'name', 'phone', 'email', 'avatar');
}
public function bookingItems(): HasMany
{
return $this->hasMany(BookingItem::class);
}
public function rooms(): BelongsToMany
{
return $this->belongsToMany(Room::class, 'booking_items');
}
public function canceledBy(): BelongsTo
{
return $this->belongsTo(User::class, 'canceled_by');
}
}

View File

@@ -0,0 +1,39 @@
<?php
namespace Modules\Booking\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class BookingItem extends Model
{
protected $fillable = [
'restaurant_id',
'booking_id',
'room_id',
'adults',
'children',
'room_price',
'nights',
'tax_amount',
'total_amount',
'status',
'created_at',
'updated_at',
'deleted_at',
];
public const TABLE_NAME = 'booking_items';
protected $table = self::TABLE_NAME;
public function booking(): BelongsTo
{
return $this->belongsTo(Booking::class);
}
public function room(): BelongsTo
{
return $this->belongsTo(Room::class)->select('id', 'room_number', 'room_code', 'image');
}
}

View File

@@ -0,0 +1,29 @@
<?php
namespace Modules\Booking\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class Floor extends Model
{
protected $fillable = [
'restaurant_id',
'hotel_id',
'name',
'level',
'status',
'created_at',
'updated_at',
'deleted_at',
];
public const TABLE_NAME = 'floors';
protected $table = self::TABLE_NAME;
public function hotel(): BelongsTo
{
return $this->belongsTo(Hotel::class)->select('id', 'name');
}
}

View File

@@ -0,0 +1,65 @@
<?php
namespace Modules\Booking\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Modules\Authentication\Models\Restaurant;
class Hotel extends Model
{
protected $fillable = [
'restaurant_id',
'name',
'location',
'email',
'phone',
'description',
'latitude',
'longitude',
'check_in_time',
'check_out_time',
'status',
];
/**
* Casts
*/
protected $casts = [
'latitude' => 'decimal:7',
'longitude' => 'decimal:7',
'check_in_time' => 'datetime:H:i',
'check_out_time' => 'datetime:H:i',
'status' => 'integer',
];
public const TABLE_NAME = 'hotels';
protected $table = self::TABLE_NAME;
public function restaurant(): BelongsTo
{
return $this->belongsTo(Restaurant::class);
}
public function floors(): HasMany
{
return $this->hasMany(Floor::class);
}
public function roomTypes(): HasMany
{
return $this->hasMany(RoomType::class);
}
public function rooms(): HasMany
{
return $this->hasMany(Room::class);
}
public function bookings(): HasMany
{
return $this->hasMany(Booking::class);
}
}

View File

@@ -0,0 +1,79 @@
<?php
namespace Modules\Booking\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
class Room extends Model
{
protected $fillable = [
'restaurant_id',
'hotel_id',
'floor_id',
'room_type_id',
'room_number',
'room_code',
'slug',
'max_adults',
'max_children',
'has_balcony',
'has_bathtub',
'view_type',
'image',
'banner_image',
'gallery_images',
'description',
'regular_price',
'offer_price',
'is_clean',
'is_available',
'status',
'created_at',
'updated_at',
'deleted_at',
];
/**
* Casts
*/
protected $casts = [
'restaurant_id' => 'integer',
'hotel_id' => 'integer',
'floor_id' => 'integer',
'room_type_id' => 'integer',
'max_adults' => 'integer',
'max_children' => 'integer',
'has_balcony' => 'boolean',
'has_bathtub' => 'boolean',
'gallery_images' => 'array',
'is_clean' => 'boolean',
'is_available' => 'boolean',
'status' => 'integer',
];
public const TABLE_NAME = 'rooms';
protected $table = self::TABLE_NAME;
public function hotel(): BelongsTo
{
return $this->belongsTo(Hotel::class);
}
public function floor(): BelongsTo
{
return $this->belongsTo(Floor::class);
}
public function roomType(): BelongsTo
{
return $this->belongsTo(RoomType::class);
}
public function bookings(): HasMany
{
return $this->hasMany(BookingItem::class, 'room_id');
}
}

View File

@@ -0,0 +1,58 @@
<?php
namespace Modules\Booking\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class RoomAvailability extends Model
{
protected $fillable = [
'restaurant_id',
'hotel_id',
'room_id',
'date',
'total_inventory',
'available_inventory',
'is_available',
'is_closed_to_arrival',
'is_closed_to_departure',
'base_price',
'extra_adult_price',
'extra_child_price',
'min_stay',
'max_stay',
'blocked_by_booking_id',
'block_type',
'note',
'status',
'created_at',
'updated_at',
'deleted_at',
];
public const TABLE_NAME = 'room_availabilities';
protected $table = self::TABLE_NAME;
public function hotel(): BelongsTo
{
return $this->belongsTo(Hotel::class);
}
public function room(): BelongsTo
{
return $this->belongsTo(Room::class);
}
public function blockedByBooking(): BelongsTo
{
return $this->belongsTo(Booking::class, 'blocked_by_booking_id');
}
}

View File

@@ -0,0 +1,49 @@
<?php
namespace Modules\Booking\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Modules\Authentication\Models\User;
class RoomBlock extends Model
{
protected $fillable = [
'restaurant_id',
'hotel_id',
'room_id',
'start_date',
'end_date',
'start_time',
'end_time',
'block_type',
'blocked_inventory',
'priority',
'reason',
'auto_release',
'created_by',
'status',
'created_at',
'updated_at',
'deleted_at',
];
public const TABLE_NAME = 'room_blocks';
protected $table = self::TABLE_NAME;
public function hotel(): BelongsTo
{
return $this->belongsTo(Hotel::class);
}
public function room(): BelongsTo
{
return $this->belongsTo(Room::class);
}
public function creator(): BelongsTo
{
return $this->belongsTo(User::class, 'created_by');
}
}

View File

@@ -0,0 +1,36 @@
<?php
namespace Modules\Booking\Models;
use Illuminate\Database\Eloquent\Model;
class RoomPrice extends Model
{
protected $fillable = [
'restaurant_id',
'room_id',
'start_date',
'end_date',
'day_type',
'price',
'priority',
'is_active',
];
/**
* Casts
*/
protected $casts = [
'restaurant_id' => 'integer',
'room_id' => 'integer',
'start_date' => 'date',
'end_date' => 'date',
'price' => 'decimal:2',
'priority' => 'integer',
'is_active' => 'boolean',
];
public const TABLE_NAME = 'room_prices';
protected $table = self::TABLE_NAME;
}

View File

@@ -0,0 +1,63 @@
<?php
namespace Modules\Booking\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
class RoomType extends Model
{
protected $fillable = [
'restaurant_id',
'hotel_id',
'name',
'capacity',
'beds',
'bed_type',
'has_ac',
'has_wifi',
'has_breakfast',
'is_refundable',
'base_price',
'weekend_price',
'extra_guest_price',
'description',
'status',
'created_at',
'updated_at',
'deleted_at',
];
/**
* Casts
*/
protected $casts = [
'restaurant_id' => 'integer',
'hotel_id' => 'integer',
'capacity' => 'integer',
'beds' => 'integer',
'has_ac' => 'boolean',
'has_wifi' => 'boolean',
'has_breakfast' => 'boolean',
'is_refundable' => 'boolean',
'base_price' => 'decimal:2',
'weekend_price' => 'decimal:2',
'extra_guest_price' => 'decimal:2',
'status' => 'integer',
];
public const TABLE_NAME = 'room_types';
protected $table = self::TABLE_NAME;
public function hotel(): BelongsTo
{
return $this->belongsTo(Hotel::class);
}
public function rooms(): HasMany
{
return $this->hasMany(Room::class);
}
}