This is a Laravel-based API for managing room bookings, customers, and payments. The API includes features such as room availability checking to prevent double bookings and token-based authentication using Laravel Sanctum.
-
Clone the repository:
git clone https://github.com/MilenPlamenov/laravel_hotel_bookings_api.git cd booking
-
Install dependencies:
composer install
-
Copy the example environment file and configure it:
cp .env.example .env
Edit the
.env
file to match your database and other configurations. -
Generate application key:
php artisan key:generate
-
Run the migrations and seed the database:
php artisan migrate --seed
-
Install Sanctum:
php artisan vendor:publish --provider="Laravel\Sanctum\SanctumServiceProvider" php artisan migrate
-
Run the application:
php artisan serve
- Get all rooms:
GET /api/rooms
- Create a room:
POST /api/rooms
- Get a single room:
GET /api/rooms/{id}
- Update a room:
PUT /api/rooms/{id}
- Delete a room:
DELETE /api/rooms/{id}
- Get all bookings:
GET /api/bookings
- Create a booking:
POST /api/bookings
- Get a single booking:
GET /api/bookings/{id}
- Update a booking:
PUT /api/bookings/{id}
- Delete a booking:
DELETE /api/bookings/{id}
- Get all payments:
GET /api/payments
- Create a payment:
POST /api/payments
- Get a single payment:
GET /api/payments/{id}
- Update a payment:
PUT /api/payments/{id}
- Delete a payment:
DELETE /api/payments/{id}
- Register:
POST /api/register
- Login:
POST /api/login
- Logout:
POST /api/logout
- Unit tests for all controllers (Auth, Booking, Room and Payment)
php artisan test