Online Booking System Source Code

The phone rings while you are with a client, your inbox fills with "is 3 pm tomorrow still free?", and two people show up for the same slot because the schedule lived in two places...

Online Booking System Source Code

The phone rings while you are with a client, your inbox fills with "is 3 pm tomorrow still free?", and two people show up for the same slot because the schedule lived in two places. That is everyday life for salons, clinics, sports courts, photo studios, and rental shops that still run on a paper diary.

An online booking system fixes this by making one calendar the single source of truth. This guide covers how such a system works, which modules matter, a database design that prevents double-booking, how to run a Laravel-based source code locally, and a checklist to use before you buy any booking script.

What a Booking System Actually Solves

  • Admin time lost to scheduling. Every back-and-forth about free slots is manual work a booking page can replace.
  • Double-booking. It happens when the schedule is kept in more than one place, or when two people grab the same slot at nearly the same moment.
  • No-shows. Customers book and never arrive, leaving staff idle and a slot wasted.

A good system does more than move the diary onto a screen. It enforces business rules automatically: service duration, opening hours, staff availability, and deposit policy.

Core Modules and Data Flow

1. Schedule and availability

This is the heart of the system. The calendar must show free slots in real time and reject overlapping requests. Slots come from opening hours minus existing bookings, adjusted for service length. A 30-minute haircut and a 90-minute treatment cannot be handled the same way.

2. Staff and services

Service businesses usually have several staff members with different skills. Customers should be able to pick a preferred person, and the system then shows only that person's open slots. A staff-to-service relation decides who can do what.

3. Automatic notifications

Send a confirmation right after booking, then a reminder before the appointment by email or a messaging app, with a link to reschedule. Reminders are the cheapest way to reduce no-shows.

4. Payments and deposits

Asking for a deposit filters out casual bookings and protects revenue against last-minute cancellations. Stripe, PayPal, or a regional gateway can all fit this flow. The integration pattern is similar to the one in integrating a payment gateway in Laravel.

5. Dashboard and reports

Owners need numbers: bookings per day, peak hours, most popular services, and no-show rate. These help plan shifts and schedule promotions for quiet hours.

6. Customer booking page

Fewer steps mean more completed bookings. The ideal flow is: choose service, choose staff (optional), choose slot, enter name and phone, pay deposit. It must work well on a phone.

The data flow looks like this: the customer picks a service and slot, the system holds the slot, the customer pays a deposit, the booking moves from pending to confirmed, and a scheduled job sends reminders. If the deposit is not paid within a time limit, the slot is released.

Recommended Table Design

Here is a minimal schema for a single location with multiple staff. If relational design is new to you, start with designing a simple ERD for your app.

TableKey columnsPurpose
servicesname, duration_minutes, price, deposit_amountService list and length
staffname, phone, is_activeBookable people
service_staffservice_id, staff_idWho can perform which service
working_hoursstaff_id, weekday, start_time, end_timeWeekly hours per staff member
bookingscustomer_name, phone, service_id, staff_id, starts_at, ends_at, statusBooked appointments
paymentsbooking_id, amount, method, paid_atDeposits and final payments

Storing ends_at instead of recalculating it lets you check conflicts with a single query. In Laravel 11 the overlap guard can look like this:

use App\Models\Booking;
use Illuminate\Support\Facades\DB;

public function store(StoreBookingRequest $request)
{
    $data = $request->validated();

    return DB::transaction(function () use ($data) {
        // Lock this staff member's rows so two requests cannot both pass
        $conflict = Booking::where('staff_id', $data['staff_id'])
            ->whereIn('status', ['pending', 'confirmed'])
            ->where('starts_at', '<', $data['ends_at'])
            ->where('ends_at', '>', $data['starts_at'])
            ->lockForUpdate()
            ->exists();

        if ($conflict) {
            abort(409, 'This slot was just taken.');
        }

        return Booking::create($data + ['status' => 'pending']);
    });
}

Two time ranges overlap when each one starts before the other ends. That single rule catches every overlap case, including a booking that sits inside another. Running lockForUpdate() inside a transaction stops two customers who click at the same second from both succeeding.

Running the Source Code Locally

  1. Install PHP 8.2+, Composer, and MySQL or MariaDB.
  2. Extract the project and run composer install.
  3. Copy .env.example to .env, fill in database credentials, and run php artisan key:generate.
  4. Run php artisan migrate --seed to create tables and sample data.
  5. Start php artisan serve and test the flow from both the customer and admin side.
  6. For reminders, run php artisan schedule:work locally, or add the cron entry * * * * * php artisan schedule:run on the server.

Customizing Safely

  • Add new columns through new migrations; never edit migrations that have already run.
  • Keep business rules such as deposit percentage, payment deadline, and buffer time in a settings table or config file, not hard-coded in controllers.
  • Use Git from day one so each change can be reviewed and reverted.

More techniques are covered in customizing source code without breaking it.

Checklist Before Buying Booking Source Code

  • Conflict checks run on the server, not just hidden slots in the UI.
  • Service duration and opening hours are configurable without code changes.
  • Multiple services and multiple staff are supported.
  • Confirmations and reminders can be scheduled.
  • Booking statuses are explicit: pending, confirmed, cancelled, completed, no-show.
  • The code follows Laravel conventions and ships with install instructions.
  • There is a demo you can test on a phone.
  • Laravel and PHP versions are stated clearly.

Common Mistakes and Fixes

MistakeResultFix
Phone bookings kept outside the systemDouble-bookingEnter every booking into the same calendar
No remindersHigh no-show rateRemind one day before and a few hours before
Long booking formAbandoned bookingsAsk only for name, phone, and slot
Wrong server timezoneAppointments shift by hoursSet APP_TIMEZONE to the business location

Limitations to Keep in Mind

Ready-made booking scripts target common cases. Multi-branch room inventory, recurring memberships, or two-way Google Calendar sync are often missing and need custom work. You also remain responsible for hosting, database backups, and security updates. As a rough example, if your front desk spends about two hours a day confirming appointments, compare that time against the cost of hosting and customization to judge whether the system pays off.

If you want a Laravel-based reference implementation, the GudangCode catalog is one place to compare code structure against the checklist above.

Yudhi
Written by
Yudhi
Founder & Lead Developer, GudangCode

Yudhi is the founder of GudangCode and a Laravel developer who has built dozens of ready-to-use business information systems — from POS and HRIS to management apps. He writes guides and articles on GudangCode to help Indonesian developers run, understand, and deploy Laravel source code correctly.

LaravelPHPMySQLSistem Informasi Bisnis See all articles by Yudhi
Want the full source code & apps?

Sign up free to download ready-to-use business applications, information systems, and Laravel source code.

Sign Up Free & Download
Source Code Booking Source Code
Share this article
Back to Blog
📚 Free Learning Hub

Learn Coding for Free at DhieCoderWeb

Explore Laravel, PHP, JavaScript tutorials, source code, web development guides, and practical programming tips.

DhieCoderWeb
100+
Tutorials
Free
Learning
SEO
Tips
Visit Dhiecoderweb.com →

Get Full Access Now!

Join our membership and unlock exclusive access to all premium features. Fast, easy, and ready to use instantly.

Join Membership Now