Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/OswalSnow/AR-Barber/llms.txt

Use this file to discover all available pages before exploring further.

The Appointment model is the core of the AR Barbería booking system. Each record represents a single booking made by a customer, linked to a specific barber (User) and optionally tagged with one or more Service records. Appointments use soft deletes, meaning a cancellation sets deleted_at rather than removing the row — historical booking data is always preserved.

Fields

id
integer
required
Auto-incrementing primary key.
customer_name
string
required
Full name of the customer as entered in the booking form.
customer_phone
string
required
Customer contact number. Must be exactly 10 digits. Validated at the controller layer before the record is stored.
servicio
string
default:"corte"
The requested service type. Added in the April 2026 migration with a default of 'corte'. Accepted values are:
  • corte — haircut only (30 minutes)
  • barba — beard trim only (30 minutes)
  • ambos — haircut and beard trim (60 minutes)
starts_at
datetime
required
The date and time the appointment begins. Stored in the database as a datetime column. Slot options are driven by the barber’s Workday schedule in 30-minute increments.
ends_at
datetime
The date and time the appointment ends. This value is computed from starts_at plus the duration implied by servicio: 30 minutes for corte or barba, 60 minutes for ambos. Added in the second migration.
status
enum
default:"pending"
Current status of the appointment. The database enforces an ENUM with three allowed values:
  • pending — appointment is booked and awaiting service (default)
  • completed — service has been delivered
  • cancelled — appointment was cancelled
user_id
integer
required
Foreign key referencing the users table. Identifies which barber the appointment is booked with.
created_at
datetime
Timestamp set automatically by Laravel when the record is created.
updated_at
datetime
Timestamp updated automatically by Laravel on every save.
deleted_at
datetime
Populated when the appointment is soft-deleted (cancelled). While this field is set, the record is excluded from standard queries. The physical row is never removed. Added in the third migration.

Relations

user() — belongsTo User

Each appointment belongs to one barber. The user_id foreign key points to the users table.
$appointment->user; // Returns the barber (User) for this booking

services() — belongsToMany Service

Appointments can be tagged with one or more Service records via the appointment_service pivot table.
$appointment->services; // Collection of Service models
The current booking flow stores the service type in the servicio string field (corte, barba, ambos) and does not attach records to the services many-to-many relation. The services() relation and appointment_service pivot table are available for future use when a richer service catalogue is needed.

Soft delete behavior

The model uses Laravel’s SoftDeletes trait. Cancelling an appointment writes the current timestamp to deleted_at. The record remains in the database and is accessible via:
Appointment::withTrashed()->find($id);   // Includes soft-deleted records
Appointment::onlyTrashed()->get();       // Only soft-deleted records
Standard queries (e.g. Appointment::all()) automatically exclude rows where deleted_at is not null.
Because cancelled appointments are never physically deleted, you can always audit booking history. If you need to permanently remove a record, call $appointment->forceDelete().

$fillable fields

The following fields are mass-assignable:
protected $fillable = [
    'customer_name',
    'customer_phone',
    'servicio',
    'starts_at',
    'ends_at',
    'status',
    'user_id',
];

Build docs developers (and LLMs) love