I'm developing a REST api in Laravel 5.2 with postgresql that handles bookings for diferent establishments that have an start_time and an end_time. The user can see in the frontend the diferents times available in a certain establishments and make a booking. Here is the problematic situation:
- Customer A wants to book an establishment. Sees that the establishment A is free from 15:00 hs to 20:00 hs
- Customer A selects the 16:00 to 17:00 time. (Have to press a button to confirm the booking)
- Customer B wants to book an establishment. Sees that the establishment A is free from 15:00 hs to 20:00
- Customer B selects the 16:00 to 17:00 apointment (Again, have to press a button to confirm the booking)
- Customer A confirms the booking
- If customer B confirms the booking, we will have 2 bookings at the same time.
Have read a lot about queues in laravel and I'm not really sure if that is the correct way to solve this problem.
The establishments doesnt have arbitrary hours so the customers can pick up a 1 or 2 or 3 hours booking.
This is my booking model
Schema::create('bookings', function (Blueprint $table) {
$table->increments('id');
$table->timestamps();
$table->timestamp('start_time');
$table->timestamp('end_time');
$table->integer('user_id')->nullable();
$table->integer('establishment_id')->nullable();
$table->string('name')->nullable();
$table->string('phone_number')->nullable();
});
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2sS0DBA
via IFTTT
Aucun commentaire:
Enregistrer un commentaire