Why double bookings happen
Most booking bugs come from a simple race: two visitors see the same free slot and submit at the same time. Checking availability in the controller is not enough.
The pattern that works
- Generate slots from configuration (working days, hours, interval, service duration).
- Filter out slots that overlap existing active bookings.
- On submit, acquire a lock for the date, re-check inside a database transaction, then insert.
$lock = Cache::lock('booking-date-'.$date, 15);
$lock->block(5);
DB::transaction(function () use ($date, $time) {
// re-check overlap with lockForUpdate()
Booking::create([...]);
});
Statuses matter
Use pending, confirmed, completed and cancelled. Only non-cancelled bookings should block a slot. When an admin cancels, the slot becomes available again automatically.
Email is part of the product
Send a receipt immediately, then notify the client when the status changes. People trust systems that communicate.
Keep reading
Career•
From Freelance Projects to Repeatable Process
The small systems that made my freelance work calmer and more predictable.
Laravel•
How I Structure a Laravel Admin Panel
A repeatable structure for CRUD modules, settings, messages and bookings that stays maintainable.
Performance•
MySQL Indexes That Actually Speed Up Your Laravel App
The indexes I add to almost every Laravel project, and how to verify they are used.