What exact part are you struggling with?
Dec 12, 2022
5
Level 9
Book rooms using Laravel
Dear artisans, how can I implement a simple room booking system without using any fancy tools such as Alpine.js, Livewire or any frontend frameworks but just using vanilla Laravel?
I have rooms table with following columns:
$table->id();
$table->string('name');
$table->integer('price');
I need to insert the room_id into bookings table like this:
$table->id();
$table->unsignedBigInteger('room_id');
$table->foreign('room_id')->references('id')->on('rooms')->cascadeOnDelete();
$table->date('check_in');
$table->date('check_out');
$table->integer('amount');
$table->boolean('status')->default(false);
$table->unsignedBigInteger('user_id');
$table->foreign('user_id')->references('id')->on('users')->cascadeOnDelete();
I have showed every rooms in the index page:
<a href="{{ route('rooms.show', $room) }}">Book Now</a>
From there user can view the room and book using a button.
I know this needs entire CRUD operations and time for a course. Your help is highly appreciated. Thank you! 🙏🙏
Please or to participate in this conversation.