Project Introduction

The Hotel Management System is a comprehensive software solution designed to streamline the operations of hotels and hospitality businesses. This system aims to enhance the efficiency of hotel management by automating various processes, including room booking, guest check-in and check-out, billing, and inventory management. With the growing demand for quality service in the hospitality industry, the need for an integrated management system has become essential for improving guest experiences and operational efficiency.

The Hotel Management System provides a user-friendly interface for hotel staff, management, and guests, allowing them to access relevant information and perform necessary tasks with ease. Key features include room availability management, online booking, customer relationship management, and reporting tools. By automating these processes, the system enhances communication, reduces manual errors, and ensures that hotel staff can focus on delivering exceptional service to their guests.

Project Objectives

  • To develop an intuitive interface for managing hotel operations and guest services.
  • To automate room booking and reservation processes for improved efficiency.
  • To implement guest check-in and check-out functionalities to streamline front desk operations.
  • To facilitate billing and invoicing for guests, including payment processing.
  • To enable inventory management for hotel supplies and amenities.
  • To generate reports on occupancy rates, revenue, and guest demographics.
  • To ensure data security and compliance with hospitality regulations and standards.
  • To enhance guest engagement through features like loyalty programs and feedback collection.

Project Modules

1. User Management Module

  • User Registration/Login: Allow hotel staff and administrators to create accounts and log in securely.
  • Role Management: Differentiate between user roles (e.g., admin, front desk staff, housekeeping, management) with varying permissions.

2. Reservation Management Module

  • Booking Engine: Allow customers to search for available rooms, check rates, and make reservations online.
  • Reservation Calendar: Provide a visual calendar for staff to manage bookings and availability.
  • Group Bookings: Facilitate group reservations and manage special requests.

3. Room Management Module

  • Room Inventory: Manage room types, rates, and availability.
  • Room Status Tracking: Track the status of rooms (e.g., available, occupied, under maintenance).
  • Room Assignment: Assign rooms to guests based on their preferences and availability.

4. Check-in and Check-out Module

  • Guest Check-in: Streamline the check-in process, including document verification and payment processing.
  • Guest Check-out: Facilitate the check-out process, including billing and payment settlement.
  • Express Check-out: Allow guests to check out quickly, often through self-service kiosks or mobile apps.

5. Billing and Invoicing Module

  • Invoice Generation: Automatically generate invoices for guests based on their stay and additional services used.
  • Payment Processing: Integrate with payment gateways for secure online and offline transactions.
  • Multi-currency Support: Allow transactions in different currencies for international guests.

6. Housekeeping Management Module

  • Task Assignment: Assign housekeeping tasks to staff based on room status and guest check-out/check-in schedules.
  • Inventory Management: Track housekeeping supplies and manage inventory levels.
  • Room Cleaning Status: Update and monitor the cleaning status of rooms in real-time.

7. Customer Relationship Management (CRM) Module

  • Guest Profiles: Maintain detailed profiles of guests, including preferences, past stays, and special requests.
  • Feedback and Reviews: Collect and manage guest feedback and reviews to improve services.
  • Loyalty Programs: Implement loyalty programs to reward repeat guests.

8. Reporting and Analytics Module

  • Occupancy Reports: Generate reports on room occupancy rates and revenue.
  • Financial Reports: Provide insights into financial performance, including revenue, expenses, and profit margins.
  • Guest Demographics: Analyze guest demographics and preferences for targeted marketing.

9. Restaurant and Bar Management Module

  • Menu Management: Manage food and beverage menus, including pricing and availability.
  • Table Reservations: Allow guests to reserve tables in the hotel restaurant or bar.
  • Order Management: Streamline order taking and processing for restaurant staff.

10. Event Management Module

  • Event Booking: Manage bookings for conferences, weddings, and other events held at the hotel.
  • Room Setup: Coordinate room setups and requirements for events.
  • Catering Services: Manage catering options and menu selections for events.

11. Marketing and Promotions Module

  • Promotional Campaigns: Create and manage promotional offers and packages.
  • Email Marketing: Send targeted email campaigns to guests and potential customers.
  • Social Media Integration: Integrate with social media platforms for marketing and engagement.
12. Security and Access Control Module
  • Data Security: Ensure that guest data is stored securely and access is controlled based on roles.
  • Audit Trails: Maintain logs of user activities for compliance and security purposes.

Project Tables Queries


-- Create Users Table
CREATE TABLE Users (
UserId INT PRIMARY KEY IDENTITY(1,1),
Username NVARCHAR(50) NOT NULL UNIQUE,
PasswordHash NVARCHAR(256) NOT NULL,
Email NVARCHAR(100) NOT NULL UNIQUE,
RoleId INT,
CreatedAt DATETIME DEFAULT GETDATE(),
FOREIGN KEY (RoleId) REFERENCES Roles(RoleId)
);
-- Create Roles Table
CREATE TABLE Roles (
RoleId INT PRIMARY KEY IDENTITY(1,1),
RoleName NVARCHAR(50) NOT NULL UNIQUE
);
-- Create Reservations Table
CREATE TABLE Reservations (
ReservationId INT PRIMARY KEY IDENTITY(1,1),
GuestId INT,
RoomId INT,
CheckInDate DATETIME NOT NULL,
CheckOutDate DATETIME NOT NULL,
NumberOfGuests INT NOT NULL,
Status NVARCHAR(50) NOT NULL, -- e.g., Confirmed, Cancelled
CreatedAt DATETIME DEFAULT GETDATE(),
FOREIGN KEY (GuestId) REFERENCES Guests(GuestId),
FOREIGN KEY (RoomId) REFERENCES Rooms(RoomId)
);
-- Create Rooms Table
CREATE TABLE Rooms (
RoomId INT PRIMARY KEY IDENTITY(1,1),
RoomNumber NVARCHAR(10) NOT NULL UNIQUE,
RoomType NVARCHAR(50) NOT NULL, -- e.g., Single, Double, Suite
Price DECIMAL(18, 2) NOT NULL,
Status NVARCHAR(50) NOT NULL, -- e.g., Available, Occupied, Maintenance
CreatedAt DATETIME DEFAULT GETDATE()
);
-- Create Invoices Table
CREATE TABLE Invoices (
InvoiceId INT PRIMARY KEY IDENTITY(1,1),
ReservationId INT,
Amount DECIMAL(18, 2) NOT NULL,
PaymentStatus NVARCHAR(50) NOT NULL, -- e.g., Paid, Unpaid
CreatedAt DATETIME DEFAULT GETDATE(),
FOREIGN KEY (ReservationId) REFERENCES Reservations(ReservationId)
);
-- Create HousekeepingTasks Table
CREATE TABLE HousekeepingTasks (
TaskId INT PRIMARY KEY IDENTITY(1,1),
RoomId INT,
TaskDescription NVARCHAR(256) NOT NULL,
Status NVARCHAR(50) NOT NULL, -- e.g., Pending, Completed
CreatedAt DATETIME DEFAULT GETDATE(),
FOREIGN KEY (RoomId) REFERENCES Rooms(RoomId)
);
-- Create Guests Table
CREATE TABLE Guests (
GuestId INT PRIMARY KEY IDENTITY(1,1),
FirstName NVARCHAR(50) NOT NULL,
LastName NVARCHAR(50) NOT NULL,
Email NVARCHAR(100) NOT NULL UNIQUE,
Phone NVARCHAR(15),
CreatedAt DATETIME DEFAULT GETDATE()
);
-- Create Feedback Table
CREATE TABLE Feedback (
FeedbackId INT PRIMARY KEY IDENTITY(1,1),
GuestId INT,
Rating INT CHECK (Rating >= 1 AND Rating <= 5),
Comments NVARCHAR(MAX),
CreatedAt DATETIME DEFAULT GETDATE(),
FOREIGN KEY (GuestId) REFERENCES Guests(GuestId)
);
-- Create MenuItems Table
CREATE TABLE MenuItems (
MenuItemId INT PRIMARY KEY IDENTITY(1,1),
Name NVARCHAR(100) NOT NULL,
Description NVARCHAR(MAX),
Price DECIMAL(18, 2) NOT NULL,
CreatedAt DATETIME DEFAULT GETDATE()
);
-- Create EventBookings Table
CREATE TABLE EventBookings (
EventBookingId INT PRIMARY KEY IDENTITY(1,1),
EventName NVARCHAR(100) NOT NULL,
BookingDate DATETIME NOT NULL,
NumberOfGuests INT NOT NULL,
CreatedAt DATETIME DEFAULT GETDATE()
);
-- Create Promotions Table
CREATE TABLE Promotions (
PromotionId INT PRIMARY KEY IDENTITY(1,1),
Code NVARCHAR(50) NOT NULL UNIQUE,
DiscountAmount DECIMAL(18, 2) NOT NULL,
ExpirationDate DATETIME NOT NULL,
IsActive BIT DEFAULT 1
);

Explanation of the Tables

Users: Stores user information, including username, password hash, email, and role.

Roles: Defines user roles (e.g., Admin, Staff).

Reservations: Contains reservation details, including guest information, room details, check-in and check-out dates, and status.

Rooms: Stores room details, including room number, type, price, and status.

Invoices: Manages billing information related to reservations, including amount and payment status.

HousekeepingTasks: Tracks housekeeping tasks for rooms, including task description and status.

Guests: Contains guest information, including first name, last name, email, and phone number.

Feedback: Stores feedback from guests, including ratings and comments.

MenuItems: Manages menu items available in the hotel's restaurant, including descriptions and prices.

EventBookings: Contains details about events booked at the hotel, including event name, booking date, and number of guests.

Promotions: Manages promotional codes, including discount amounts and expiration dates.

To create the models and migrations for the provided MySQL queries in Laravel 11, you can follow these steps.

Step 1: Create Migrations

You can create migrations using the Artisan command. For example, to create a migration for the Users table, you would run:


php artisan make:migration create_users_table

Repeat this for each table. Below are the migration files for each table based on your SQL schema.

Migration for Users Table


// database/migrations/2025_02_01_000001_create_users_table.php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateUsersTable extends Migration
{
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->id('User Id');
$table->string('Username', 50)->unique();
$table->string('PasswordHash', 256);
$table->string('Email', 100)->unique();
$table->foreignId('RoleId')->nullable()->constrained('roles', 'RoleId');
$table->timestamps(0);
});
}
public function down()
{
Schema::dropIfExists('users');
}
}

Migration for Roles Table


// database/migrations/2025_02_01_000002_create_roles_table.php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateRolesTable extends Migration
{
public function up()
{
Schema::create('roles', function (Blueprint $table) {
$table->id('RoleId');
$table->string('RoleName', 50)->unique();
$table->timestamps(0);
});
}
public function down()
{
Schema::dropIfExists('roles');
}
}

Migration for Reservations Table


// database/migrations/2025_02_01_000003_create_reservations_table.php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateReservationsTable extends Migration
{
public function up()
{
Schema::create('reservations', function (Blueprint $table) {
$table->id('ReservationId');
$table->foreignId('GuestId')->constrained('guests', 'GuestId')->nullable();
$table->foreignId('RoomId')->constrained('rooms', 'RoomId')->nullable();
$table->dateTime('CheckInDate');
$table->dateTime('CheckOutDate');
$table->integer('NumberOfGuests');
$table->string('Status', 50);
$table->timestamps(0);
});
}
public function down()
{
Schema::dropIfExists('reservations');
}
}

Migration for Rooms Table


// database/migrations/2025_02_01_000004_create_rooms_table.php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateRoomsTable extends Migration
{
public function up()
{
Schema::create('rooms', function (Blueprint $table) {
$table->id('RoomId');
$table->string('RoomNumber', 10)->unique();
$table->string('RoomType', 50);
$table->decimal('Price', 18, 2);
$table->string('Status', 50);
$table->timestamps(0);
});
}
public function down()
{
Schema::dropIfExists('rooms');
}
}

Migration for Invoices Table


// database/migrations/2025_02_01_000005_create_invoices_table.php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateInvoicesTable extends Migration
{
public function up()
{
Schema::create('invoices', function (Blueprint $table) {
$table->id('InvoiceId');
$table->foreignId('ReservationId')->constrained('reservations', 'ReservationId')->nullable();
$table->decimal('Amount', 18, 2);
$table->string('PaymentStatus', 50);
$table->timestamps(0);
});
}
public function down()
{
Schema::dropIfExists('invoices');
}
}

Migration for HousekeepingTasks Table


// database/migrations/2025_02_01_000006_create_housekeeping_tasks_table.php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateHousekeepingTasksTable extends Migration
{
public function up()
{
Schema::create('housekeeping_tasks', function (Blueprint $table) {
$table->id('TaskId');
$table->foreignId('RoomId')->constrained('rooms', 'RoomId')->nullable();
$table->string('TaskDescription', 256);
$table->string('Status', 50);
$table->timestamps(0);
});
}
public function down()
{
Schema::dropIfExists('housekeeping_tasks');
}
}

Migration for Guests Table


// database/migrations/2025_02_01_000007_create_guests_table.php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateGuestsTable extends Migration
{
public function up()
{
Schema::create('guests', function (Blueprint $table) {
$table->id('GuestId');
$table->string('FirstName', 50);
$table->string('LastName', 50);
$table->string('Email', 100)->unique();
$table->string('Phone', 15)->nullable();
$table->timestamps(0);
});
}
public function down()
{
Schema::dropIfExists('guests');
}
}

Migration for Feedback Table


// database/migrations/2025_02_01_000008_create_feedback_table.php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateFeedbackTable extends Migration
{
public function up()
{
Schema::create('feedback', function (Blueprint $table) {
$table->id('FeedbackId');
$table->foreignId('GuestId')->constrained('guests', 'GuestId')->nullable();
$table->integer('Rating')->check('Rating >= 1 AND Rating <= 5');
$table->text('Comments')->nullable();
$table->timestamps(0);
});
}
public function down()
{
Schema::dropIfExists('feedback');
}
}

Migration for MenuItems Table


// database/migrations/2025_02_01_000009_create_menu_items_table.php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateMenuItemsTable extends Migration
{
public function up()
{
Schema::create('menu_items', function (Blueprint $table) {
$table->id('MenuItemId');
$table->string('Name', 100);
$table->text('Description')->nullable();
$table->decimal('Price', 18, 2);
$table->timestamps(0);
});
}
public function down()
{
Schema::dropIfExists('menu_items');
}
}

Migration for EventBookings Table


// database/migrations/2025_02_01_000010_create_event_bookings_table.php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateEventBookingsTable extends Migration
{
public function up()
{
Schema::create('event_bookings', function (Blueprint $table) {
$table->id('EventBookingId');
$table->string('EventName', 100);
$table->dateTime('BookingDate');
$table->integer('NumberOfGuests');
$table->timestamps(0);
});
}
public function down()
{
Schema::dropIfExists('event_bookings');
}
}

Migration for Promotions Table


// database/migrations/2025_02_01_000011_create_promotions_table.php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePromotionsTable extends Migration
{
public function up()
{
Schema::create('promotions', function (Blueprint $table) {
$table->id('PromotionId');
$table->string('Code', 50)->unique();
$table->decimal('DiscountAmount', 18, 2);
$table->dateTime('ExpirationDate');
$table->boolean('IsActive')->default(true);
});
}
public function down()
{
Schema::dropIfExists('promotions');
}
}

Step 2: Create Models

You can create models using the Artisan command. For example, to create a model for the User, you would run:


php artisan make:model

Repeat this for each table. Below are the model files for each table.

User Model


// app/Models/User.php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class User extends Model
{
use HasFactory;
protected $table = 'users';
protected $fillable = [
'Username',
'PasswordHash',
'Email',
'RoleId',
];
}

Role Model


// app/Models/Role.php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Role extends Model
{
use HasFactory;
protected $table = 'roles';
protected $fillable = [
'RoleName',
];
}

Reservation Model


// app/Models/Reservation.php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Reservation extends Model
{
use HasFactory;
protected $table = 'reservations';
protected $fillable = [
'GuestId',
'RoomId',
'CheckInDate',
'CheckOutDate',
'NumberOfGuests',
'Status',
];
}

Room Model


// app/Models/Room.php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Room extends Model
{
use HasFactory;
protected $table = 'rooms';
protected $fillable = [
'RoomNumber',
'RoomType',
'Price',
'Status',
];
}

Invoice Model


// app/Models/Invoice.php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Invoice extends Model
{
use HasFactory;
protected $table = 'invoices';
protected $fillable = [
'ReservationId',
'Amount',
'PaymentStatus',
];
}

HousekeepingTask Model


// app/Models/HousekeepingTask.php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class HousekeepingTask extends Model
{
use HasFactory;
protected $table = 'housekeeping_tasks';
protected $fillable = [
'RoomId',
'TaskDescription',
'Status',
];
}

Guest Model


// app/Models/Guest.php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Guest extends Model
{
use HasFactory;
protected $table = 'guests';
protected $fillable = [
'FirstName',
'LastName',
'Email',
'Phone',
];
}

Feedback Model


// app/Models/Feedback.php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Feedback extends Model
{
use HasFactory;
protected $table = 'feedback';
protected $fillable = [
'GuestId',
'Rating',
'Comments',
];
}

MenuItem Model


// app/Models/MenuItem.php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class MenuItem extends Model
{
use HasFactory;
protected $table = 'menu_items';
protected $fillable = [
'Name',
'Description',
'Price',
];
}

EventBooking Model


// app/Models/EventBooking.php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class EventBooking extends Model
{
use HasFactory;
protected $table = 'event_bookings';
protected $fillable = [
'EventName',
'BookingDate',
'NumberOfGuests',
];
}

Promotion Model


// app/Models/Promotion.php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Promotion extends Model
{
use HasFactory;
protected $table = 'promotions';
protected $fillable = [
'Code',
'DiscountAmount',
'ExpirationDate',
'IsActive',
];
}

Step 3: Run Migrations

After creating the migration files, you can run the migrations using the following command:


php artisan migrate

This will create the tables in your database according to the defined schema.

To create controllers for each model with complete CRUD operations in Laravel, you can use the Artisan command to generate resource controllers. Each controller will handle the basic CRUD operations: Create, Read, Update, and Delete.

Step 1: Create Controllers

You can create a resource controller for each model using the following command:


php artisan make:controller UserController --resource
php artisan make:controller RoleController --resource
php artisan make:controller ReservationController --resource
php artisan make:controller RoomController --resource
php artisan make:controller InvoiceController --resource
php artisan make:controller HousekeepingTaskController --resource
php artisan make:controller GuestController --resource
php artisan make:controller FeedbackController --resource
php artisan make:controller MenuItemController --resource
php artisan make:controller EventBookingController --resource
php artisan make:controller PromotionController --resource

Step 2: Implement CRUD Operations

Below are the implementations for each controller. Each controller will have methods for the CRUD operations.

UserController


// app/Http/Controllers/UserController.php
namespace App\Http\Controllers;
use App\Models\User;
use Illuminate\Http\Request;
class UserController extends Controller
{
public function index()
{
$users = User::all();
return view('users.index', compact('users'));
}
public function create()
{
return view('users.create');
}
public function store(Request $request)
{
$request->validate([
'Username' => 'required|unique:users|max:50',
'PasswordHash' => 'required',
'Email' => 'required|email|unique:users|max:100',
'RoleId' => 'nullable|exists:roles,RoleId',
]);
User::create($request->all());
return redirect()->route('users.index')->with('success', 'User created successfully.');
}
public function show(User $user)
{
return view('users.show', compact('user'));
}
public function edit(User $user)
{
return view('users.edit', compact('user'));
}
public function update(Request $request, User $user)
{
$request->validate([
'Username' => 'required|max:50|unique:users,Username,' . $user->User Id,
'PasswordHash' => 'required',
'Email' => 'required|email|max:100|unique:users,Email,' . $user->User Id,
'RoleId' => 'nullable|exists:roles,RoleId',
]);
$user->update($request->all());
return redirect()->route('users.index')->with('success', 'User updated successfully.');
}
public function destroy(User $user)
{
$user->delete();
return redirect()->route('users.index')->with('success', 'User deleted successfully.');
}
}

RoleController


// app/Http/Controllers/RoleController.php
namespace App\Http\Controllers;
use App\Models\Role;
use Illuminate\Http\Request;
class RoleController extends Controller
{
public function index()
{
$roles = Role::all();
return view('roles.index', compact('roles'));
}
public function create()
{
return view('roles.create');
}
public function store(Request $request)
{
$request->validate([
'RoleName' => 'required|unique:roles|max:50',
]);
Role::create($request->all());
return redirect()->route('roles.index')->with('success', 'Role created successfully.');
}
public function show(Role $role)
{
return view('roles.show', compact('role'));
}
public function edit(Role $role)
{
return view('roles.edit', compact('role'));
}
public function update(Request $request, Role $role)
{
$request->validate([
'RoleName' => 'required|max:50|unique:roles,RoleName,' . $role->RoleId,
]);
$role->update($request->all());
return redirect()->route('roles.index')->with('success', 'Role updated successfully.');
}
public function destroy(Role $role)
{
$role->delete();
return redirect()->route('roles.index')->with('success', 'Role deleted successfully.');
}
}

ReservationController


// app/Http/Controllers/ReservationController.php
namespace App\Http\Controllers;
use App\Models\Reservation;
use App\Models\Guest;
use App\Models\Room;
use Illuminate\Http\Request;
class ReservationController extends Controller
{
public function index()
{
$reservations = Reservation::all();
return view('reservations.index', compact('reservations'));
}
public function create()
{
$guests = Guest::all();
$rooms = Room::all();
return view('reservations.create', compact('guests', 'rooms'));
}
public function store(Request $request)
{
$request->validate([
'GuestId' => 'required|exists:guests,GuestId',
'RoomId' => 'required|exists:rooms,RoomId',
'CheckInDate' => ' required|date',
'CheckOutDate' => 'required|date|after:CheckInDate',
'NumberOfGuests' => 'required|integer',
'Status' => 'required|string|max:50',
]);
Reservation::create($request->all());
return redirect()->route('reservations.index')->with('success', 'Reservation created successfully.');
}
public function show(Reservation $reservation)
{
return view('reservations.show', compact('reservation'));
}
public function edit(Reservation $reservation)
{
$guests = Guest::all();
$rooms = Room::all();
return view('reservations.edit', compact('reservation', 'guests', 'rooms'));
}
public function update(Request $request, Reservation $reservation)
{
$request->validate([
'GuestId' => 'required|exists:guests,GuestId',
'RoomId' => 'required|exists:rooms,RoomId',
'CheckInDate' => 'required|date',
'CheckOutDate' => 'required|date|after:CheckInDate',
'NumberOfGuests' => 'required|integer',
'Status' => 'required|string|max:50',
]);
$reservation->update($request->all());
return redirect()->route('reservations.index')->with('success', 'Reservation updated successfully.');
}
public function destroy(Reservation $reservation)
{
$reservation->delete();
return redirect()->route('reservations.index')->with('success', 'Reservation deleted successfully.');
}
}

RoomController


// app/Http/Controllers/RoomController.php
namespace App\Http\Controllers;
use App\Models\Room;
use Illuminate\Http\Request;
class RoomController extends Controller
{
public function index()
{
$rooms = Room::all();
return view('rooms.index', compact('rooms'));
}
public function create()
{
return view('rooms.create');
}
public function store(Request $request)
{
$request->validate([
'RoomNumber' => 'required|unique:rooms|max:10',
'RoomType' => 'required|string|max:50',
'Price' => 'required|numeric',
'Status' => 'required|string|max:50',
]);
Room::create($request->all());
return redirect()->route('rooms.index')->with('success', 'Room created successfully.');
}
public function show(Room $room)
{
return view('rooms.show', compact('room'));
}
public function edit(Room $room)
{
return view('rooms.edit', compact('room'));
}
public function update(Request $request, Room $room)
{
$request->validate([
'RoomNumber' => 'required|max:10|unique:rooms,RoomNumber,' . $room->RoomId,
'RoomType' => 'required|string|max:50',
'Price' => 'required|numeric',
'Status' => 'required|string|max:50',
]);
$room->update($request->all());
return redirect()->route('rooms.index')->with('success', 'Room updated successfully.');
}
public function destroy(Room $room)
{
$room->delete();
return redirect()->route('rooms.index')->with('success', 'Room deleted successfully.');
}
}

InvoiceController


// app/Http/Controllers/InvoiceController.php
namespace App\Http\Controllers;
use App\Models\Invoice;
use App\Models\Reservation;
use Illuminate\Http\Request;
class InvoiceController extends Controller
{
public function index()
{
$invoices = Invoice::all();
return view('invoices.index', compact('invoices'));
}
public function create()
{
$reservations = Reservation::all();
return view('invoices.create', compact('reservations'));
}
public function store(Request $request)
{
$request->validate([
'ReservationId' => 'required|exists:reservations,ReservationId',
'Amount' => 'required|numeric',
'PaymentStatus' => 'required|string|max:50',
]);
Invoice::create($request->all());
return redirect()->route('invoices.index')->with('success', 'Invoice created successfully.');
}
public function show(Invoice $invoice)
{
return view('invoices.show', compact('invoice'));
}
public function edit(Invoice $invoice)
{
$reservations = Reservation::all();
return view('invoices.edit', compact('invoice', 'reservations'));
}
public function update(Request $request, Invoice $invoice)
{
$request->validate([
'ReservationId' => 'required|exists:reservations,ReservationId',
'Amount' => 'required|numeric',
'Payment Status' => 'required|string|max:50',
]);
$invoice->update($request->all());
return redirect()->route('invoices.index')->with('success', 'Invoice updated successfully.');
}
public function destroy(Invoice $invoice)
{
$invoice->delete();
return redirect()->route('invoices.index')->with('success', 'Invoice deleted successfully.');
}
}

HousekeepingTaskController


// app/Http/Controllers/HousekeepingTaskController.php
namespace App\Http\Controllers;
use App\Models\HousekeepingTask;
use App\Models\Room;
use Illuminate\Http\Request;
class HousekeepingTaskController extends Controller
{
public function index()
{
$tasks = HousekeepingTask::all();
return view('housekeeping_tasks.index', compact('tasks'));
}
public function create()
{
$rooms = Room::all();
return view('housekeeping_tasks.create', compact('rooms'));
}
public function store(Request $request)
{
$request->validate([
'RoomId' => 'required|exists:rooms,RoomId',
'TaskDescription' => 'required|string|max:256',
'Status' => 'required|string|max:50',
]);
HousekeepingTask::create($request->all());
return redirect()->route('housekeeping_tasks.index')->with('success', 'Task created successfully.');
}
public function show(HousekeepingTask $task)
{
return view('housekeeping_tasks.show', compact('task'));
}
public function edit(HousekeepingTask $task)
{
$rooms = Room::all();
return view('housekeeping_tasks.edit', compact('task', 'rooms'));
}
public function update(Request $request, HousekeepingTask $task)
{
$request->validate([
'RoomId' => 'required|exists:rooms,RoomId',
'TaskDescription' => 'required|string|max:256',
'Status' => 'required|string|max:50',
]);
$task->update($request->all());
return redirect()->route('housekeeping_tasks.index')->with('success', 'Task updated successfully.');
}
public function destroy(HousekeepingTask $task)
{
$task->delete();
return redirect()->route('housekeeping_tasks.index')->with('success', 'Task deleted successfully.');
}
}

GuestController


// app/Http/Controllers/GuestController.php
namespace App\Http\Controllers;
use App\Models\Guest;
use Illuminate\Http\Request;
class GuestController extends Controller
{
public function index()
{
$guests = Guest::all();
return view('guests.index', compact('guests'));
}
public function create()
{
return view('guests.create');
}
public function store(Request $request)
{
$request->validate([
'FirstName' => 'required|string|max:50',
'LastName' => 'required|string|max:50',
'Email' => 'required|email|unique:guests,Email|max:100',
'Phone' => 'nullable|string|max:15',
]);
Guest::create($request->all());
return redirect()->route('guests.index')->with('success', 'Guest created successfully.');
}
public function show(Guest $guest)
{
return view('guests.show', compact('guest'));
}
public function edit(Guest $guest)
{
return view('guests.edit', compact('guest'));
}
public function update(Request $request, Guest $guest)
{
$request->validate([
'FirstName' => 'required|string|max:50',
'LastName' => 'required|string|max:50',
'Email' => 'required|email|unique:guests,Email,' . $guest->GuestId . '|max:100',
'Phone' => 'nullable|string|max:15',
]);
$guest->update($request->all());
return redirect()->route('guests.index')->with('success', 'Guest updated successfully.');
}
public function destroy(Guest $guest)
{
$guest->delete();
return redirect()->route('guests.index')->with('success', 'Guest deleted successfully.');
}
}

FeedbackController


// app/Http/Controllers/FeedbackController.php
namespace App\Http\Controllers;
use App\Models\Feedback;
use App\Models\Guest;
use Illuminate\Http\Request;
class FeedbackController extends Controller
{
public function index()
{
$feedbacks = Feedback::all();
return view('feedback.index', compact('feedbacks'));
}
public function create()
{
$guests = Guest::all();
return view('feedback.create', compact('guests'));
}
public function store(Request $request)
{
$request->validate([
'GuestId' => 'required|exists:guests,GuestId',
'Rating' => 'required|integer|between:1,5',
'Comments' => 'nullable|string',
]);
Feedback::create($request->all());
return redirect()->route('feedback.index')->with('success', 'Feedback created successfully.');
}
public function show(Feedback $feedback)
{
return view('feedback.show', compact('feedback'));
}
public function edit(Feedback $feedback)
{
$guests = Guest::all();
return view('feedback.edit', compact('feedback', 'guests'));
}
public function update(Request $request, Feedback $feedback)
{
$request->validate([
'GuestId' => 'required|exists:guests,GuestId',
'Rating' => 'required|integer|between:1,5',
'Comments' => 'nullable|string',
]);
$feedback->update($request->all());
return redirect()->route('feedback.index')->with('success', 'Feedback updated successfully.');
}
public function destroy(Feedback $feedback)
{
$feedback->delete();
return redirect()->route('feedback.index')->with('success', 'Feedback deleted successfully.');
}
}

MenuItemController


// app/Http/Controllers/MenuItemController.php
namespace App\Http\Controllers;
use App\Models\MenuItem;
use Illuminate\Http\Request;
class MenuItemController extends Controller
{
public function index()
{
$menuItems = MenuItem::all();
return view('menu_items.index', compact('menuItems'));
}
public function create()
{
return view('menu_items.create');
}
public function store(Request $request)
{
$request->validate([
'Name' => 'required|string|max:100',
'Description' => 'nullable|string',
'Price' => 'required|numeric',
]);
MenuItem::create($request->all());
return redirect()->route('menu_items.index')->with('success', 'Menu item created successfully.');
}
public function show(MenuItem $menuItem)
{
return view('menu_items.show', compact('menuItem'));
}
public function edit(MenuItem $menuItem)
{
return view('menu_items.edit', compact('menuItem'));
}
public function update(Request $request, MenuItem $menuItem)
{
$request->validate([
'Name' => 'required|string|max:100',
'Description' => 'nullable|string',
'Price' => 'required|numeric',
]);
$menuItem->update($request->all());
return redirect()->route('menu_items.index')->with('success', 'Menu item updated successfully.');
}
public function destroy(MenuItem $menuItem)
{
$menuItem->delete();
return redirect()->route('menu_items.index')->with('success', 'Menu item deleted successfully.');
}
}

EventBookingController


// app/Http/Controllers/EventBookingController.php
namespace App\Http\Controllers;
use App\Models\EventBooking;
use Illuminate\Http\Request;
class EventBookingController extends Controller
{
public function index()
{
$eventBookings = EventBooking::all();
return view('event_bookings.index', compact('eventBookings'));
}
public function create()
{
return view('event_bookings.create');
}
public function store(Request $request)
{
$request->validate([
'EventName' => 'required|string|max:100',
'BookingDate' => 'required|date',
'NumberOfGuests' => 'required|integer',
]);
EventBooking::create($request->all());
return redirect()->route('event_bookings.index')->with('success', 'Event booking created successfully.');
}
public function show(EventBooking $eventBooking)
{
return view('event_bookings.show', compact('eventBooking'));
}
public function edit(EventBooking $eventBooking)
{
return view('event_bookings.edit', compact('eventBooking'));
}
public function update(Request $request, EventBooking $eventBooking)
{
$request->validate([
'EventName' => 'required|string|max:100',
'BookingDate' => 'required|date',
'NumberOfGuests' => 'required|integer',
]);
$eventBooking->update($request->all());
return redirect()->route('event_bookings.index')->with('success', 'Event booking updated successfully.');
}
public function destroy(EventBooking $eventBooking)
{
$eventBooking->delete();
return redirect()->route('event_bookings.index')->with('success', 'Event booking deleted successfully.');
}
}
PromotionController

// app/Http/Controllers/PromotionController.php

namespace App\Http\Controllers;
use App\Models\Promotion;
use Illuminate\Http\Request;
class PromotionController extends Controller
{
public function index()
{
$promotions = Promotion::all();
return view('promotions.index', compact('promotions'));
}
public function create()
{
return view('promotions.create');
}
public function store(Request $request)
{
$request->validate([
'Code' => 'required|string|max:50|unique:promotions',
'DiscountAmount' => 'required|numeric',
'ExpirationDate' => 'required|date',
'IsActive' => 'boolean',
]);
Promotion::create($request->all());
return redirect()->route('promotions.index')->with('success', 'Promotion created successfully.');
}
public function show(Promotion $promotion)
{
return view('promotions.show', compact('promotion'));
}
public function edit(Promotion $promotion)
{
return view('promotions.edit', compact('promotion'));
}
public function update(Request $request, Promotion $promotion)
{
$request->validate([
'Code' => 'required|string|max:50|unique:promotions,Code,' . $promotion->PromotionId,
'DiscountAmount' => 'required|numeric',
'ExpirationDate' => 'required|date',
'IsActive' => 'boolean',
]);
$promotion->update($request->all());
return redirect()->route('promotions.index')->with('success', 'Promotion updated successfully.');
}
public function destroy(Promotion $promotion)
{
$promotion->delete();
return redirect()->route('promotions.index')->with('success', 'Promotion deleted successfully.');
}
}

Step 3: Define Routes

You will need to define routes for each controller in your routes/web.php file. Here's an example of how to set up the routes for the User Controller:


use App\Http\Controllers\UserController;
use App\Http\Controllers\RoleController;
use App\Http\Controllers\ReservationController;
use App\Http\Controllers\RoomController;
use App\Http\Controllers\InvoiceController;
use App\Http\Controllers\HousekeepingTaskController;
use App\Http\Controllers\GuestController;
use App\Http\Controllers\FeedbackController;
use App\Http\Controllers\MenuItemController;
use App\Http\Controllers\EventBookingController;
use App\Http\Controllers\PromotionController;
Route::resource('users', UserController::class);
Route::resource('roles', RoleController::class);
Route::resource('reservations', ReservationController::class);
Route::resource('rooms', RoomController::class);
Route::resource('invoices', InvoiceController::class);
Route::resource('housekeeping_tasks', HousekeepingTaskController::class);
Route::resource('guests', GuestController::class);
Route::resource('feedback', FeedbackController::class);
Route::resource('menu_items', MenuItemController::class);
Route::resource('event_bookings', EventBookingController::class);
Route::resource('promotions', PromotionController::class);

Step 4: Create Views

You will also need to create views for each of the CRUD operations. This typically includes index, create, edit, show, and delete confirmation views for each model. You can create these views in the resources/views directory, following the structure of your controllers.

This setup will provide a complete CRUD interface for each model in your Laravel application.

Creating view files for each controller using Bootstrap 5

Creating view files for each controller using Bootstrap 5 involves creating a set of Blade templates in Laravel. Below, I will provide a basic structure for each view file, including the necessary HTML and Bootstrap 5 classes.

Directory Structure

You can create a directory structure like this in resources/views:


resources/views/
├── users/
│ ├── index.blade.php
│ ├── create.blade.php
│ ├── edit.blade.php
│ ├── show.blade.php
├── roles/
│ ├── index.blade.php
│ ├── create.blade.php
│ ├── edit.blade.php
│ ├── show.blade.php
├── reservations/
│ ├── index.blade.php
│ ├── create.blade.php
│ ├── edit.blade.php
│ ├── show.blade.php
├── rooms/
│ ├── index.blade.php
│ ├── create.blade.php
│ ├── edit.blade.php
│ ├── show.blade.php
├── invoices/
│ ├── index.blade.php
│ ├── create.blade.php
│ ├── edit.blade.php
│ ├── show.blade.php
├── housekeeping_tasks/
│ ├── index.blade.php
│ ├── create.blade.php
│ ├── edit.blade.php
│ ├── show.blade.php
├── guests/
│ ├── index.blade.php
│ ├── create.blade.php
│ ├── edit.blade.php
│ ├── show.blade.php
├── feedback/
│ ├── index.blade.php
│ ├── create.blade.php
│ ├── edit.blade.php
│ ├── show.blade.php
├── menu_items/
│ ├── index.blade.php
│ ├── create.blade.php
│ ├── edit.blade.php
│ ├── show.blade.php
├── event_bookings/
│ ├── index.blade.php
│ ├── create.blade.php
│ ├── edit.blade.php
│ ├── show.blade.php
├── promotions/
│ ├── index.blade.php
│ ├── create.blade.php
│ ├── edit.blade.php
│ ├── show.blade.php

Example View Files

Here are example view files for each model. You can customize them further based on your requirements.

1. Users Views

index.blade.php

@extends('layouts.app')
@section('content')
<div class="container">
<h1>Users</h1>
<a href="{{ route('users.create') }}" class="btn btn-primary mb-3">Create User</a>
<table class="table">
<thead>
<tr>
<th>Username</th>
<th>Email</th>
<th>Role</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
@foreach ($users as $user)
<tr>
<td>{{ $user->Username }}</td>
<td>{{ $user->Email }}</td>
<td>{{ $user->RoleId }}</td>
<td>
<a href="{{ route('users.edit', $user) }}" class="btn btn-warning">Edit</a>
<form action="{{ route('users.destroy', $user) }}" method="POST" style="display:inline;">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-danger">Delete</button>
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@endsection
create.blade.php

@extends('layouts.app')
@section('content')
<div class="container">
<h1>Create User</h1>
<form action="{{ route('users.store') }}" method="POST">
@csrf
<div class="mb-3">
<label for="Username" class="form-label">Username</label>
<input type="text" class="form-control" id="Username" name="Username" required>
</div>
<div class="mb-3">
<label for="PasswordHash" class="form-label">Password</label>
<input type="password" class="form-control" id="PasswordHash" name="PasswordHash" required>
</div>
<div class="mb-3">
<label for="Email" class="form-label">Email</label>
<input type="email" class="form-control" id="Email" name="Email" required>
</div>
<div class="mb-3">
<label for="RoleId" class="form-label">Role ID</label>
<input type="number" class ="form-control" id="RoleId" name="RoleId">
</div>
<button type="submit" class="btn btn-success">Create User</button>
</form>
</div>
@endsection
edit.blade.php

@extends('layouts.app')
@section('content')
<div class="container">
<h1>Edit User</h1>
<form action="{{ route('users.update', $user) }}" method="POST">
@csrf
@method('PUT')
<div class="mb-3">
<label for="Username" class="form-label">Username</label>
<input type="text" class="form-control" id="Username" name="Username" value="{{ $user->Username }}" required>
</div>
<div class="mb-3">
<label for="PasswordHash" class="form-label">Password</label>
<input type="password" class="form-control" id="PasswordHash" name="PasswordHash" required>
</div>
<div class="mb-3">
<label for="Email" class="form-label">Email</label>
<input type="email" class="form-control" id="Email" name="Email" value="{{ $user->Email }}" required>
</div>
<div class="mb-3">
<label for="RoleId" class="form-label">Role ID</label>
<input type="number" class="form-control" id="RoleId" name="RoleId" value="{{ $user->RoleId }}">
</div>
<button type="submit" class="btn btn-primary">Update User</button>
</form>
</div>
@endsection
show.blade.php

@extends('layouts.app')
@section('content')
<div class="container">
<h1>User Details</h1>
<p><strong>Username:</strong> {{ $user->Username }}</p>
<p><strong>Email:</strong> {{ $user->Email }}</p>
<p><strong>Role ID:</strong> {{ $user->RoleId }}</p>
<a href="{{ route('users.edit', $user) }}" class="btn btn-warning">Edit</a>
<a href="{{ route('users.index') }}" class="btn btn-secondary">Back to Users</a>
</div>
@endsection

2. Roles Views

index.blade.php

@extends('layouts.app')
@section('content')
<div class="container">
<h1>Roles</h1>
<a href="{{ route('roles.create') }}" class="btn btn-primary mb-3">Create Role</a>
<table class="table">
<thead>
<tr>
<th>Role Name</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
@foreach ($roles as $role)
<tr>
<td>{{ $role->RoleName }}</td>
<td>
<a href="{{ route('roles.edit', $role) }}" class="btn btn-warning">Edit</a>
<form action="{{ route('roles.destroy', $role) }}" method="POST" style="display:inline;">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-danger">Delete</button>
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@endsection
create.blade.php

@extends('layouts.app')
@section('content')
<div class="container">
<h1>Create Role</h1>
<form action="{{ route('roles.store') }}" method="POST">
@csrf
<div class="mb-3">
<label for="RoleName" class="form-label">Role Name</label>
<input type="text" class="form-control" id="RoleName" name="RoleName" required>
</div>
<button type="submit" class="btn btn-success">Create Role</button>
</form>
</div>
@endsection
edit.blade.php

@extends('layouts.app')
@section('content')
<div class="container">
<h1>Edit Role</h1>
<form action="{{ route('roles.update', $role) }}" method="POST">
@csrf
@method('PUT')
<div class="mb-3">
<label for="RoleName" class="form-label">Role Name</label>
<input type="text" class="form-control" id="RoleName" name="RoleName" value="{{ $role->RoleName }}" required>
</div>
<button type="submit" class="btn btn -primary">Update Role</button>
</form>
</div>
@endsection
show.blade.php

@extends('layouts.app')
@section('content')
<div class="container">
<h1>Role Details</h1>
<p><strong>Role Name:</strong> {{ $role->RoleName }}</p>
<a href="{{ route('roles.edit', $role) }}" class="btn btn-warning">Edit</a>
<a href="{{ route('roles.index') }}" class="btn btn-secondary">Back to Roles</a>
</div>
@endsection

3. Reservations Views

index.blade.php

@extends('layouts.app')
@section('content')
<div class="container">
<h1>Reservations</h1>
<a href="{{ route('reservations.create') }}" class="btn btn-primary mb-3">Create Reservation</a>
<table class="table">
<thead>
<tr>
<th>Guest</th>
<th>Room</th>
<th>Check-In</th>
<th>Check-Out</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
@foreach ($reservations as $reservation)
<tr>
<td>{{ $reservation->GuestId }}</td>
<td>{{ $reservation->RoomId }}</td>
<td>{{ $reservation->CheckInDate }}</td>
<td>{{ $reservation->CheckOutDate }}</td>
<td>
<a href="{{ route('reservations.edit', $reservation) }}" class="btn btn-warning">Edit</a>
<form action="{{ route('reservations.destroy', $reservation) }}" method="POST" style="display:inline;">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-danger">Delete</button>
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@endsection
create.blade.php

@extends('layouts.app')
@section('content')
<div class="container">
<h1>Create Reservation</h1>
<form action="{{ route('reservations.store') }}" method="POST">
@csrf
<div class="mb-3">
<label for="GuestId" class="form-label">Guest ID</label>
<input type="number" class="form-control" id="GuestId" name="GuestId" required>
</div>
<div class="mb-3">
<label for="RoomId" class="form-label">Room ID</label>
<input type="number" class="form-control" id="RoomId" name="RoomId" required>
</div>
<div class="mb-3">
<label for="CheckInDate" class="form-label">Check-In Date</label>
<input type="date" class="form-control" id="CheckInDate" name="CheckInDate" required>
</div>
<div class="mb-3">
<label for="CheckOutDate" class="form-label">Check-Out Date</label>
<input type="date" class="form-control" id="CheckOutDate" name="CheckOutDate" required>
</div>
<div class="mb-3">
<label for="NumberOfGuests" class="form-label">Number of Guests</label>
<input type="number" class="form-control" id="NumberOfGuests" name="NumberOfGuests" required>
</div>
<div class="mb-3">
<label for="Status" class="form-label">Status</label>
<input type="text" class="form-control" id="Status" name="Status" required>
</div>
<button type="submit" class="btn btn-success">Create Reservation</button>
</form>
</div>
@endsection
edit.blade.php

@extends('layouts.app')
@section('content')
<div class="container">
<h1>Edit Reservation</h1>
<form action="{{ route('reservations.update', $reservation) }}" method="POST">
@csrf
@method('PUT')
<div class="mb-3">
<label for="GuestId" class="form-label">Guest ID</label>
<input type="number" class="form-control" id="GuestId" name="GuestId" value="{{ $reservation->GuestId }}" required>
</div>
<div class="mb-3">
<label for="RoomId" class="form-label">Room ID</label>
<input type="number" class="form-control" id="RoomId " name="RoomId" value="{{ $reservation->RoomId }}" required>
</div>
<div class="mb-3">
<label for="CheckInDate" class="form-label">Check-In Date</label>
<input type="date" class="form-control" id="CheckInDate" name="CheckInDate" value="{{ $reservation->CheckInDate }}" required>
</div>
<div class="mb-3">
<label for="CheckOutDate" class="form-label">Check-Out Date</label>
<input type="date" class="form-control" id="CheckOutDate" name="CheckOutDate" value="{{ $reservation->CheckOutDate }}" required>
</div>
<div class="mb-3">
<label for="NumberOfGuests" class="form-label">Number of Guests</label>
<input type="number" class="form-control" id="NumberOfGuests" name="NumberOfGuests" value="{{ $reservation->NumberOfGuests }}" required>
</div>
<div class="mb-3">
<label for="Status" class="form-label">Status</label>
<input type="text" class="form-control" id="Status" name="Status" value="{{ $reservation->Status }}" required>
</div>
<button type="submit" class="btn btn-primary">Update Reservation</button>
</form>
</div>
@endsection
show.blade.php

@extends('layouts.app')
@section('content')
<div class="container">
<h1>Reservation Details</h1>
<p><strong>Guest ID:</strong> {{ $reservation->GuestId }}</p>
<p><strong>Room ID:</strong> {{ $reservation->RoomId }}</p>
<p><strong>Check-In Date:</strong> {{ $reservation->CheckInDate }}</p>
<p><strong>Check-Out Date:</strong> {{ $reservation->CheckOutDate }}</p>
<p><strong>Number of Guests:</strong> {{ $reservation->NumberOfGuests }}</p>
<p><strong>Status:</strong> {{ $reservation->Status }}</p>
<a href="{{ route('reservations.edit', $reservation) }}" class="btn btn-warning">Edit</a>
<a href="{{ route('reservations.index') }}" class="btn btn-secondary">Back to Reservations</a>
</div>
@endsection

4. Rooms Views

index.blade.php

@extends('layouts.app')
@section('content')
<div class="container">
<h1>Rooms</h1>
<a href="{{ route('rooms.create') }}" class="btn btn-primary mb-3">Create Room</a>
<table class="table">
<thead>
<tr>
<th>Room Number</th>
<th>Room Type</th>
<th>Price</th>
<th>Status</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
@foreach ($rooms as $room)
<tr>
<td>{{ $room->RoomNumber }}</td>
<td>{{ $room->RoomType }}</td>
<td>{{ $room->Price }}</td>
<td>{{ $room->Status }}</td>
<td>
<a href="{{ route('rooms.edit', $room) }}" class="btn btn-warning">Edit</a>
<form action="{{ route('rooms.destroy', $room) }}" method="POST" style="display:inline;">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-danger">Delete</button>
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@endsection
create.blade.php

@extends('layouts.app')
@section('content')
<div class="container">
<h1>Create Room</h1>
<form action="{{ route('rooms.store') }}" method="POST">
@csrf
<div class="mb-3">
<label for="RoomNumber" class="form-label">Room Number</label>
<input type="text" class="form-control" id="RoomNumber" name="RoomNumber" required>
</div>
<div class="mb-3">
<label for="RoomType" class="form-label">Room Type</label>
<input type="text" class="form-control" id="RoomType" name="RoomType" required>
</div>
<div class="mb-3">
<label for="Price" class="form-label">Price</label>
<input type="number" class="form-control" id="Price" name="Price" required>
</div>
<div class="mb-3">
<label for="Status" class="form-label">Status</label>
<input type="text" class="form-control" id="Status" name="Status" required>
</div>
<button type="submit" class="btn btn-success">Create Room</button>
</form>
</div>
@endsection
edit.blade.php

@extends('layouts.app')
@section('content')
<div class="container">
<h1>Edit Room</h1>
<form action="{{ route('rooms.update', $room) }}" method="POST">
@csrf
@method('PUT')
<div class="mb-3">
<label for="RoomNumber" class="form-label">Room Number</label>
<input type="text" class="form-control" id="RoomNumber" name="RoomNumber" value="{{ $room->RoomNumber }}" required>
</div>
<div class="mb-3">
<label for="RoomType" class="form-label">Room Type</label>
<input type="text" class="form-control" id="RoomType" name="RoomType" value="{{ $room->RoomType }}" required>
</div>
<div class="mb-3">
<label for="Price" class="form-label">Price</label>
<input type="number" class="form-control" id="Price" name="Price" value="{{ $room->Price }}" required>
</div>
<div class="mb-3">
<label for="Status" class="form-label">Status</label>
<input type="text" class="form-control" id="Status" name="Status" value="{{ $room->Status }}" required>
</div>
<button type="submit" class="btn btn-primary">Update Room</button>
</form>
</div>
@endsection
show.blade.php

@extends('layouts.app')
@section('content')
<div class="container">
<h1>Room Details</h1>
<p><strong>Room Number:</strong> {{ $room->RoomNumber }}</p>
<p><strong>Room Type:</strong> {{ $room->RoomType }}</p>
<p><strong>Price:</strong> {{ $room->Price }}</p>
<p><strong>Status:</strong> {{ $room->Status }}</p>
<a href="{{ route('rooms.edit', $room) }}" class="btn btn-warning">Edit</a>
<a href="{{ route('rooms.index') }}" class="btn btn-secondary">Back to Rooms</a>
</div>
@endsection

5. Invoices Views

index.blade.php

@extends('layouts.app')
@section('content')
<div class="container">
<h1>Invoices</h1>
<a href="{{ route('invoices.create') }}" class="btn btn-primary mb-3">Create Invoice</a>
<table class="table">
<thead>
<tr>
<th>Reservation ID</th>
<th>Amount</th>
<th>Payment Status</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
@foreach ($invoices as $invoice)
<tr>
<td>{{ $invoice->ReservationId }}</td>
<td>{{ $invoice->Amount }}</td>
<td>{{ $invoice->PaymentStatus }}</td>
<td>
<a href="{{ route('invoices.edit', $invoice) }}" class="btn btn-warning">Edit</a>
<form action="{{ route('invoices.destroy', $invoice) }}" method="POST" style="display:inline;">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-danger">Delete</button>
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@endsection
create.blade.php

@extends('layouts.app')
@section('content')
<div class="container">
<h1>Create Invoice</h1>
<form action="{{ route('invoices.store') }}" method="POST">
@csrf
<div class="mb-3">
<label for="ReservationId" class="form-label">Reservation ID</label>
<input type="number" class="form-control" id="ReservationId" name="ReservationId" required>
</div>
<div class="mb-3">
<label for="Amount" class="form-label">Amount</label>
<input type="number" class="form-control" id=" Amount" name="Amount" required>
</div>
<div class="mb-3">
<label for="PaymentStatus" class="form-label">Payment Status</label>
<input type="text" class="form-control" id="PaymentStatus" name="PaymentStatus" required>
</div>
<button type="submit" class="btn btn-success">Create Invoice</button>
</form>
</div>
@endsection
edit.blade.php

@extends('layouts.app')
@section('content')
<div class="container">
<h1>Edit Invoice</h1>
<form action="{{ route('invoices.update', $invoice) }}" method="POST">
@csrf
@method('PUT')
<div class="mb-3">
<label for="ReservationId" class="form-label">Reservation ID</label>
<input type="number" class="form-control" id="ReservationId" name="ReservationId" value="{{ $invoice->ReservationId }}" required>
</div>
<div class="mb-3">
<label for="Amount" class="form-label">Amount</label>
<input type="number" class="form-control" id="Amount" name="Amount" value="{{ $invoice->Amount }}" required>
</div>
<div class="mb-3">
<label for="PaymentStatus" class="form-label">Payment Status</label>
<input type="text" class="form-control" id="PaymentStatus" name="PaymentStatus" value="{{ $invoice->PaymentStatus }}" required>
</div>
<button type="submit" class="btn btn-primary">Update Invoice</button>
</form>
</div>
@endsection
show.blade.php

@extends('layouts.app')
@section('content')
<div class="container">
<h1>Invoice Details</h1>
<p><strong>Reservation ID:</strong> {{ $invoice->ReservationId }}</p>
<p><strong>Amount:</strong> {{ $invoice->Amount }}</p>
<p><strong>Payment Status:</strong> {{ $invoice->PaymentStatus }}</p>
<a href="{{ route('invoices.edit', $invoice) }}" class="btn btn-warning">Edit</a>
<a href="{{ route('invoices.index') }}" class="btn btn-secondary">Back to Invoices</a>
</div>
@endsection

6. Housekeeping Tasks Views

index.blade.php

@extends('layouts.app')
@section('content')
<div class="container">
<h1>Housekeeping Tasks</h1>
<a href="{{ route('housekeeping_tasks.create') }}" class="btn btn-primary mb-3">Create Task</a>
<table class="table">
<thead>
<tr>
<th>Room ID</th>
<th>Task Description</th>
<th>Status</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
@foreach ($tasks as $task)
<tr>
<td>{{ $task->RoomId }}</td>
<td>{{ $task->TaskDescription }}</td>
<td>{{ $task->Status }}</td>
<td>
<a href="{{ route('housekeeping_tasks.edit', $task) }}" class="btn btn-warning">Edit</a>
<form action="{{ route('housekeeping_tasks.destroy', $task) }}" method="POST" style="display:inline;">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-danger">Delete</button>
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@endsection
create.blade.php

@extends('layouts.app')
@section('content')
<div class="container">
<h1>Create Housekeeping Task</h1>
<form action="{{ route('housekeeping_tasks.store') }}" method="POST">
@csrf
<div class="mb-3">
<label for="RoomId" class="form-label">Room ID</label>
<input type="number" class="form-control" id="RoomId" name="RoomId" required>
</div>
<div class="mb-3">
<label for="TaskDescription" class="form-label">Task Description</label>
<input type="text" class="form-control" id="TaskDescription" name="TaskDescription" required>
</div>
<div class="mb-3">
<label for="Status" class="form-label">Status</label>
<input type="text" class="form-control" id="Status" name="Status" required </div>
<button type="submit" class="btn btn-success">Create Task</button>
</form>
</div>
@endsection
edit.blade.php

@extends('layouts.app')
@section('content')
<div class="container">
<h1>Edit Housekeeping Task</h1>
<form action="{{ route('housekeeping_tasks.update', $task) }}" method="POST">
@csrf
@method('PUT')
<div class="mb-3">
<label for="RoomId" class="form-label">Room ID</label>
<input type="number" class="form-control" id="RoomId" name="RoomId" value="{{ $task->RoomId }}" required>
</div>
<div class="mb-3">
<label for="TaskDescription" class="form-label">Task Description</label>
<input type="text" class="form-control" id="TaskDescription" name="TaskDescription" value="{{ $task->TaskDescription }}" required>
</div>
<div class="mb-3">
<label for="Status" class="form-label">Status</label>
<input type="text" class="form-control" id="Status" name="Status" value="{{ $task->Status }}" required>
</div>
<button type="submit" class="btn btn-primary">Update Task</button>
</form>
</div>
@endsection
show.blade.php

@extends('layouts.app')
@section('content')
<div class="container">
<h1>Housekeeping Task Details</h1>
<p><strong>Room ID:</strong> {{ $task->RoomId }}</p>
<p><strong>Task Description:</strong> {{ $task->TaskDescription }}</p>
<p><strong>Status:</strong> {{ $task->Status }}</p>
<a href="{{ route('housekeeping_tasks.edit', $task) }}" class="btn btn-warning">Edit</a>
<a href="{{ route('housekeeping_tasks.index') }}" class="btn btn-secondary">Back to Tasks</a>
</div>
@endsection

7. Guests Views

index.blade.php

@extends('layouts.app')
@section('content')
<div class="container">
<h1>Guests</h1>
<a href="{{ route('guests.create') }}" class="btn btn-primary mb-3">Create Guest</a>
<table class="table">
<thead>
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>Email</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
@foreach ($guests as $guest)
<tr>
<td>{{ $guest->FirstName }}</td>
<td>{{ $guest->LastName }}</td>
<td>{{ $guest->Email }}</td>
<td>
<a href="{{ route('guests.edit', $guest) }}" class="btn btn-warning">Edit</a>
<form action="{{ route('guests.destroy', $guest) }}" method="POST" style="display:inline;">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-danger">Delete</button>
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@endsection
create.blade.php

@extends('layouts.app')
@section('content')
<div class="container">
<h1>Create Guest</h1>
<form action="{{ route('guests.store') }}" method="POST">
@csrf
<div class="mb-3">
<label for="FirstName" class="form-label">First Name</label>
<input type="text" class="form-control" id="FirstName" name="FirstName" required>
</div>
<div class="mb-3">
<label for="LastName" class="form-label">Last Name</label>
<input type="text" class="form-control" id="LastName" name="LastName" required>
</div>
<div class="mb-3">
<label for="Email" class="form-label">Email</label>
<input type="email" class="form-control" id="Email" name="Email" required>
</div>
<div class="mb-3">
<label for="Phone" class="form-label">Phone</label>
<input type="text" class="form-control" id="Phone" name="Phone">
</div>
<button type="submit" class="btn btn-success"> Create Guest</button>
</form>
</div>
@endsection
edit.blade.php

@extends('layouts.app')
@section('content')
<div class="container">
<h1>Edit Guest</h1>
<form action="{{ route('guests.update', $guest) }}" method="POST">
@csrf
@method('PUT')
<div class="mb-3">
<label for="FirstName" class="form-label">First Name</label>
<input type="text" class="form-control" id="FirstName" name="FirstName" value="{{ $guest->FirstName }}" required>
</div>
<div class="mb-3">
<label for="LastName" class="form-label">Last Name</label>
<input type="text" class="form-control" id="LastName" name="LastName" value="{{ $guest->LastName }}" required>
</div>
<div class="mb-3">
<label for="Email" class="form-label">Email</label>
<input type="email" class="form-control" id="Email" name="Email" value="{{ $guest->Email }}" required>
</div>
<div class="mb-3">
<label for="Phone" class="form-label">Phone</label>
<input type="text" class="form-control" id="Phone" name="Phone" value="{{ $guest->Phone }}">
</div>
<button type="submit" class="btn btn-primary">Update Guest</button>
</form>
</div>
@endsection
show.blade.php

@extends('layouts.app')
@section('content')
<div class="container">
<h1>Guest Details</h1>
<p><strong>First Name:</strong> {{ $guest->FirstName }}</p>
<p><strong>Last Name:</strong> {{ $guest->LastName }}</p>
<p><strong>Email:</strong> {{ $guest->Email }}</p>
<p><strong>Phone:</strong> {{ $guest->Phone }}</p>
<a href="{{ route('guests.edit', $guest) }}" class="btn btn-warning">Edit</a>
<a href="{{ route('guests.index') }}" class="btn btn-secondary">Back to Guests</a>
</div>
@endsection

8. Feedback Views

index.blade.php

@extends('layouts.app')
@section('content')
<div class="container">
<h1>Feedback</h1>
<a href="{{ route('feedback.create') }}" class="btn btn-primary mb-3">Create Feedback</a>
<table class="table">
<thead>
<tr>
<th>Guest ID</th>
<th>Rating</th>
<th>Comments</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
@foreach ($feedbacks as $feedback)
<tr>
<td>{{ $feedback->GuestId }}</td>
<td>{{ $feedback->Rating }}</td>
<td>{{ $feedback->Comments }}</td>
<td>
<a href="{{ route('feedback.edit', $feedback) }}" class="btn btn-warning">Edit</a>
<form action="{{ route('feedback.destroy', $feedback) }}" method="POST" style="display:inline;">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-danger">Delete</button>
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@endsection
create.blade.php

@extends('layouts.app')
@section('content')
<div class="container">
<h1>Create Feedback</h1>
<form action="{{ route('feedback.store') }}" method="POST">
@csrf
<div class="mb-3">
<label for="GuestId" class="form-label">Guest ID</label>
<input type="number" class="form-control" id="GuestId" name="GuestId" required>
</div>
<div class="mb-3">
<label for="Rating" class="form-label">Rating</label>
<input type="number" class="form-control" id="Rating" name="Rating" min="1" max="5" required>
</div>
<div class="mb-3">
<label for="Comments" class="form-label">Comments</label>
<textarea class="form-control" id="Comments" name="Comments"></textarea>
</div>
<button type="submit" class="btn btn-success">Create Feedback</button </form>
</div>
@endsection
edit.blade.php

@extends('layouts.app')
@section('content')
<div class="container">
<h1>Edit Feedback</h1>
<form action="{{ route('feedback.update', $feedback) }}" method="POST">
@csrf
@method('PUT')
<div class="mb-3">
<label for="GuestId" class="form-label">Guest ID</label>
<input type="number" class="form-control" id="GuestId" name="GuestId" value="{{ $feedback->GuestId }}" required>
</div>
<div class="mb-3">
<label for="Rating" class="form-label">Rating</label>
<input type="number" class="form-control" id="Rating" name="Rating" value="{{ $feedback->Rating }}" min="1" max="5" required>
</div>
<div class="mb-3">
<label for="Comments" class="form-label">Comments</label>
<textarea class="form-control" id="Comments" name="Comments">{{ $feedback->Comments }}</textarea>
</div>
<button type="submit" class="btn btn-primary">Update Feedback</button>
</form>
</div>
@endsection
show.blade.php

@extends('layouts.app')
@section('content')
<div class="container">
<h1>Feedback Details</h1>
<p><strong>Guest ID:</strong> {{ $feedback->GuestId }}</p>
<p><strong>Rating:</strong> {{ $feedback->Rating }}</p>
<p><strong>Comments:</strong> {{ $feedback->Comments }}</p>
<a href="{{ route('feedback.edit', $feedback) }}" class="btn btn-warning">Edit</a>
<a href="{{ route('feedback.index') }}" class="btn btn-secondary">Back to Feedback</a>
</div>
@endsection

9. Menu Items Views

index.blade.php

@extends('layouts.app')
@section('content')
<div class="container">
<h1>Menu Items</h1>
<a href="{{ route('menu_items.create') }}" class="btn btn-primary mb-3">Create Menu Item</a>
<table class="table">
<thead>
<tr>
<th>Name</th>
<th>Description</th>
<th>Price</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
@foreach ($menuItems as $menuItem)
<tr>
<td>{{ $menuItem->Name }}</td>
<td>{{ $menuItem->Description }}</td>
<td>{{ $menuItem->Price }}</td>
<td>
<a href="{{ route('menu_items.edit', $menuItem) }}" class="btn btn-warning">Edit</a>
<form action="{{ route('menu_items.destroy', $menuItem) }}" method="POST" style="display:inline;">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-danger">Delete</button>
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@endsection
create.blade.php

@extends('layouts.app')
@section('content')
<div class="container">
<h1>Create Menu Item</h1>
<form action="{{ route('menu_items.store') }}" method="POST">
@csrf
<div class="mb-3">
<label for="Name" class="form-label">Name</label>
<input type="text" class="form-control" id="Name" name="Name" required>
</div>
<div class="mb-3">
<label for="Description" class="form-label">Description</label>
<textarea class="form-control" id="Description" name="Description"></textarea>
</div>
<div class="mb-3">
<label for="Price" class="form-label">Price</label>
<input type="number" class="form-control" id="Price" name="Price" required>
</div>
<button type="submit" class="btn btn-success">Create Menu Item</button>
</form>
</div>
@endsection
edit.blade.php

@extends('layouts.app')
@section('content')
<div class="container">
<h1>Edit Menu Item</h1>
<form action="{{ route('menu_items.update', $menuItem) }}" method="POST">
@csrf
@method('PUT')
<div class="mb-3">
<label for="Name" class="form-label">Name</label>
<input type="text" class="form-control" id="Name" name="Name" value="{{ $menuItem->Name }}" required>
</div>
<div class="mb-3">
<label for="Description" class="form-label">Description</label>
<textarea class="form-control" id="Description" name="Description">{{ $menuItem->Description }}</textarea>
</div>
<div class="mb-3">
<label for="Price" class="form-label">Price</label>
<input type="number" class="form-control" id="Price" name="Price" value="{{ $menuItem->Price }}" required>
</div>
<button type="submit" class="btn btn-primary">Update Menu Item</button>
</form>
</div>
@endsection
show.blade.php

@extends('layouts.app')
@section('content')
<div class="container">
<h1>Menu Item Details</h1>
<p><strong>Name:</strong> {{ $menuItem->Name }}</p>
<p><strong>Description:</strong> {{ $menuItem->Description }}</p>
<p><strong>Price:</strong> {{ $menuItem->Price }}</p>
<a href="{{ route('menu_items.edit', $menuItem) }}" class="btn btn-warning">Edit</a>
<a href="{{ route('menu_items.index') }}" class="btn btn-secondary">Back to Menu Items</a>
</div>
@endsection

10. Event Bookings Views

index.blade.php

@extends('layouts.app')
@section('content')
<div class="container">
<h1>Event Bookings</h1>
<a href="{{ route('event_bookings.create') }}" class="btn btn-primary mb-3">Create Event Booking</a>
<table class="table">
<thead>
<tr>
<th>Event Name</th>
<th>Booking Date</th>
<th>Number of Guests</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
@foreach ($eventBookings as $eventBooking)
<tr>
<td>{{ $eventBooking->EventName }}</td>
<td>{{ $eventBooking->BookingDate }}</td>
<td>{{ $eventBooking->NumberOfGuests }}</td>
<td>
<a href="{{ route('event_bookings.edit', $eventBooking) }}" class="btn btn-warning">Edit</a>
<form action="{{ route('event_bookings.destroy', $eventBooking) }}" method="POST" style="display:inline;">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-danger">Delete</button>
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@endsection
create.blade.php

@extends('layouts.app')
@section('content')
<div class="container">
<h1>Create Event Booking</h1>
<form action="{{ route('event_bookings.store') }}" method="POST">
@csrf
<div class="mb-3">
<label for="EventName" class="form-label">Event Name</label>
<input type="text" class="form-control" id="EventName" name="EventName" required>
</div>
<div class="mb-3">
<label for="BookingDate" class="form-label">Booking Date</label>
<input type="date" class="form-control" id="BookingDate" name="BookingDate" required>
</div>
<div class="mb-3">
<label for="NumberOfGuests" class="form-label">Number of Guests</label>
<input type="number" class="form-control" id="NumberOfGuests" name="NumberOfGuests" required>
</div>
<button type="submit" class="btn btn-success">Create Event Booking</button>
</form>
</div>
@endsection
edit.blade.php

@extends('layouts.app')
@section('content')
<div class="container">
<h1>Edit Event Booking</h1>
<form action="{{ route('event_bookings.update', $eventBooking) }}" method="POST">
@csrf
@method('PUT')
<div class="mb-3">
<label for="EventName" class="form-label">Event Name</label>
<input type="text" class="form-control" id="EventName" name="EventName" value="{{ $eventBooking->EventName }}" required </div>
<div class="mb-3">
<label for="BookingDate" class="form-label">Booking Date</label>
<input type="date" class="form-control" id="BookingDate" name="BookingDate" value="{{ $eventBooking->BookingDate }}" required>
</div>
<div class="mb-3">
<label for="NumberOfGuests" class="form-label">Number of Guests</label>
<input type="number" class="form-control" id="NumberOfGuests" name="NumberOfGuests" value="{{ $eventBooking->NumberOfGuests }}" required>
</div>
<button type="submit" class="btn btn-primary">Update Event Booking</button>
</form>
</div>
@endsection
show.blade.php

@extends('layouts.app')
@section('content')
<div class="container">
<h1>Event Booking Details</h1>
<p><strong>Event Name:</strong> {{ $eventBooking->EventName }}</p>
<p><strong>Booking Date:</strong> {{ $eventBooking->BookingDate }}</p>
<p><strong>Number of Guests:</strong> {{ $eventBooking->NumberOfGuests }}</p>
<a href="{{ route('event_bookings.edit', $eventBooking) }}" class="btn btn-warning">Edit</a>
<a href="{{ route('event_bookings.index') }}" class="btn btn-secondary">Back to Event Bookings</a>
</div>
@endsection

11. Promotions Views

index.blade.php

@extends('layouts.app')
@section('content')
<div class="container">
<h1>Promotions</h1>
<a href="{{ route('promotions.create') }}" class="btn btn-primary mb-3">Create Promotion</a>
<table class="table">
<thead>
<tr>
<th>Code</th>
<th>Discount Amount</th>
<th>Expiration Date</th>
<th>Is Active</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
@foreach ($promotions as $promotion)
<tr>
<td>{{ $promotion->Code }}</td>
<td>{{ $promotion->DiscountAmount }}</td>
<td>{{ $promotion->ExpirationDate }}</td>
<td>{{ $promotion->IsActive ? 'Yes' : 'No' }}</td>
<td>
<a href="{{ route('promotions.edit', $promotion) }}" class="btn btn-warning">Edit</a>
<form action="{{ route('promotions.destroy', $promotion) }}" method="POST" style="display:inline;">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-danger">Delete</button>
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@endsection
create.blade.php

@extends('layouts.app')
@section('content')
<div class="container">
<h1>Create Promotion</h1>
<form action="{{ route('promotions.store') }}" method="POST">
@csrf
<div class="mb-3">
<label for="Code" class="form-label">Code</label>
<input type="text" class="form-control" id="Code" name="Code" required>
</div>
<div class="mb-3">
<label for="DiscountAmount" class="form-label">Discount Amount</label>
<input type="number" class="form-control" id="DiscountAmount" name="DiscountAmount" required>
</div>
<div class="mb-3">
<label for="ExpirationDate" class="form-label">Expiration Date</label>
<input type="date" class="form-control" id="ExpirationDate" name="ExpirationDate" required>
</div>
<div class="mb-3">
<label for="IsActive" class="form-label">Is Active</label>
<select class="form-control" id="IsActive" name="IsActive">
<option value="1">Yes</option>
<option value="0">No</option>
</select>
</div>
<button type="submit" class="btn btn-success">Create Promotion</button>
</form>
</div>
@endsection
edit.blade.php

@extends('layouts.app')
@section('content')
<div class="container">
<h1>Edit Promotion</h1>
<form action="{{ route('promotions.update', $promotion) }}" method="POST">
@csrf
@method('PUT')
<div class="mb-3">
<label for="Code" class="form-label">Code</label>
<input type="text" class="form-control" id="Code" name="Code" value="{{ $promotion->Code }}" required>
</div>
<div class="mb-3">
<label for="DiscountAmount" class="form-label">Discount Amount</label>
<input type="number" class="form-control" id="DiscountAmount" name="DiscountAmount" value="{{ $promotion->DiscountAmount }}" required>
</div>
<div class="mb-3">
<label for="ExpirationDate" class="form-label">Expiration Date</label>
<input type="date" class="form-control" id="ExpirationDate" name="ExpirationDate" value="{{ $promotion->ExpirationDate }}" required>
</div>
<div class="mb-3">
<label for="IsActive" class="form-label">Is Active</label>
<select class="form-control" id="IsActive" name="IsActive">
<option value="1" {{ $promotion->IsActive ? 'selected' : '' }}>Yes</option>
<option value="0" {{ !$promotion->IsActive ? 'selected' : '' }}>No</option>
</select>
</div>
<button type="submit" class="btn btn-primary">Update Promotion</button>
</form>
</div>
@endsection
show.blade.php

@extends('layouts.app')
@section('content')
<div class="container">
<h1>Promotion Details</h1>
<p><strong>Code:</strong> {{ $promotion->Code }}</p>
<p><strong>Discount Amount:</strong> {{ $promotion->DiscountAmount }}</p>
<p><strong>Expiration Date:</strong> {{ $promotion->ExpirationDate }}</p>
<p><strong>Is Active:</strong> {{ $promotion->IsActive ? 'Yes' : 'No' }}</p>
<a href="{{ route('promotions.edit', $promotion) }}" class="btn btn-warning">Edit</a>
<a href="{{ route('promotions.index') }}" class="btn btn-secondary">Back to Promotions</a>
</div>
@endsection

Creating a layout file in Laravel

Creating a layout file in Laravel allows you to define a common structure for your views, which can include headers, footers, and any other elements that should be consistent across multiple pages. Below is an example of a layout file using Bootstrap 5.

Step 1: Create the Layout File

Create a new file named app.blade.php in the resources/views/layouts directory:

resources/views/layouts/app.blade.php

Step 2: Define the Layout Structure

Here's a basic structure for the app.blade.php layout file:


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@yield('title', 'My Application')</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="{{ asset('css/app.css') }}"> <!-- Optional custom CSS -->
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
<a class="navbar-brand" href="{{ url('/') }}">My Application</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="{{ route('users.index') }}">Users</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ route('roles.index') }}">Roles</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ route('reservations.index') }}">Reservations</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ route('rooms.index') }}">Rooms</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ route('invoices.index') }}">Invoices</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ route('housekeeping_tasks.index') }}">Housekeeping Tasks</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ route('guests.index') }}">Guests</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ route('feedback.index') }}">Feedback</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ route('menu_items.index') }}">Menu Items</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ route('event_bookings.index') }}">Event Bookings</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ route('promotions.index') }}">Promotions</a>
</li>
</ul>
</div>
</div>
</nav>
<div class="container mt-4">
@if(session('success'))
<div class="alert alert-success">
{{ session('success') }}
</div>
@endif
@yield('content')
</div>
<footer class="bg-light text-center text-lg-start mt-4">
<div class="text-center p-3">
© 2023 My Application
</div>
</footer>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>

Explanation of the Layout File

HTML Structure: The layout file starts with the standard HTML structure, including the <!DOCTYPE html> declaration and the <html> tag.

Head Section:

The <head> section includes meta tags for character set and viewport settings.

The title of the page can be set using @yield('title', 'My Application'), allowing individual views to specify their own titles.

Bootstrap CSS is included via a CDN link.

Navigation Bar:

A responsive navigation bar is created using Bootstrap classes. It includes links to different sections of the application (e.g., Users, Roles, Reservations, etc.).

The route() function is used to generate URLs for the named routes.

Content Section:

The main content area is defined with @yield('content'), which allows individual views to insert their content into this section.

A success message is displayed if it exists in the session.

Footer:

A simple footer is included at the bottom of the page.

Scripts

To create a dashboard page in your Laravel application that displays consolidated data related to your project, you will need to follow these steps:

Step 1: Create a Route for the Dashboard: Define a route in your routes/web.php file.

Step 2: Create a Controller Method: Create a method in a controller to fetch the necessary data.

Step 3: Create the Dashboard View: Create a Blade view file to display the dashboard.

Step 1: Create a Route for the Dashboard

Add the following route to your routes/web.php file:


use App\Http\Controllers\DashboardController;
Route::get('/dashboard', [DashboardController::class, 'index'])->name('dashboard');

Step 2: Create a Controller Method

You can create a new controller for the dashboard or use an existing one. Here, I will create a new DashboardController.

Run the following command to create the controller:


php artisan make:controller DashboardController

Then, open the newly created DashboardController.php file and add the following code:


// app/Http/Controllers/DashboardController.php
namespace App\Http\Controllers;
use App\Models\User;
use App\Models\Role;
use App\Models\Reservation;
use App\Models\Room;
use App\Models\Invoice;
use App\Models\Guest;
use App\Models\Feedback;
use App\Models\MenuItem;
use App\Models\EventBooking;
use App\Models\Promotion;
use Illuminate\Http\Request;
class DashboardController extends Controller
{
public function index()
{
$userCount = User::count();
$roleCount = Role::count();
$reservationCount = Reservation::count();
$roomCount = Room::count();
$invoiceCount = Invoice::count();
$guestCount = Guest::count();
$feedbackCount = Feedback::count();
$menuItemCount = MenuItem::count();
$eventBookingCount = EventBooking::count();
$promotionCount = Promotion::count();
return view('dashboard.index', compact(
'userCount',
'roleCount',
'reservationCount',
'roomCount',
'invoiceCount',
'guestCount',
'feedbackCount',
'menuItemCount',
'eventBookingCount',
'promotionCount'
));
}
}

Step 3: Create the Dashboard View
Create a new Blade view file for the dashboard at resources/views/dashboard/index.blade.php:

@extends('layouts.app')
@section('content')
<div class="container">
<h1>Dashboard</h1>
<div class="row">
<div class="col-md-3">
<div class="card text-white bg-primary mb-3">
<div class="card-header">Users</div>
<div class="card-body">
<h5 class="card-title">{{ $userCount }}</h5>
<p class="card-text">Total number of users.</p>
</div>
</div>
</div>
<div class="col-md-3">
<div class="card text-white bg-success mb-3">
<div class="card-header">Roles</div>
<div class="card-body">
<h5 class="card-title">{{ $roleCount }}</h5>
<p class="card-text">Total number of roles.</p>
</div>
</div>
</div>
<div class="col-md-3">
<div class="card text-white bg-warning mb-3">
<div class="card-header">Reservations</div>
<div class="card-body">
<h5 class="card-title">{{ $reservationCount }}</h5>
<p class="card-text">Total number of reservations.</p>
</div>
</div>
</div>
<div class="col-md-3">
<div class="card text-white bg-danger mb-3">
<div class="card-header">Rooms</div>
<div class="card-body">
<h5 class="card-title">{{ $roomCount }}</h5>
<p class="card-text">Total number of rooms.</p>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-3">
<div class="card text-white bg-info mb-3">
<div class="card-header">Invoices</div>
<div class="card-body">
<h5 class="card-title">{{ $invoiceCount }}</h5>
<p class="card-text">Total number of invoices.</p>
</div>
</div>
</div>
<div class="col-md-3">
<div class="card text-white bg-secondary mb-3">
<div class="card-header">Guests</div>
<div class="card-body">
<h5 class="card-title">{{ $guestCount }}</h5>
<p class="card-text">Total number of guests.</p>
</div>
</div>
</div>
<div class="col-md-3">
<div class="card text-white bg-dark mb-3">
<div class="card-header">Feedback</div>
<div class="card-body">
<h5 class="card-title">{{ $feedbackCount }}</h5>
<p class="card-text">Total number of feedback entries.</p>
</div>
</div>
</div>
<div class="col-md-3">
<div class="card text-white bg-light mb-3">
<div class="card-header">Menu Items</div>
<div class="card-body">
<h5 class="card-title">{{ $menuItemCount }}</h5>
<p class="card-text">Total number of menu items.</p>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-3">
<div class="card text-white bg-primary mb-3">
<div class="card-header">Event Bookings</div>
<div class="card-body">
<h5 class="card-title">{{ $eventBookingCount }}</h5>
<p class="card-text">Total number of event bookings.</p>
</div>
</div>
</div>
<div class="col-md-3">
<div class="card text-white bg-success mb-3">
<div class="card-header">Promotions</div>
<div class="card-body">
<h5 class="card-title">{{ $promotionCount }}</h5>
<p class="card-text">Total number of promotions.</p>
</div>
</div>
</div>
</div>
</div>
@endsection

Summary

This setup provides a dashboard that displays consolidated data for various entities in your application. Each card represents a different aspect of your project, showing the total count of users, roles, reservations, rooms, invoices, guests, feedback, menu items, event bookings, and promotions. You can further customize the dashboard by adding charts or additional statistics as needed.