Authentication & Users
users 31 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK, auto-inc) | no | — | Primary key |
| first_name | varchar(255) | no | — | |
| last_name | varchar(255) | yes | — | |
varchar(255) | no | — | Originally unique; unique dropped, replaced by composite `(email, type)` | |
| phone | varchar(255) | no | — | Originally unique; unique dropped, replaced by composite `(phone, type)` |
| image | varchar(255) | yes | — | |
| two_factor_secret | text | yes | — | |
| two_factor_recovery_codes | text | yes | — | |
| two_factor_confirmed_at | timestamp | yes | — | |
| email_verified_at | timestamp | yes | — | |
| type | enum('admin','vendor','customer','employee') | no | — | `'employee'` added in 2025_10_05 |
| model_id | bigint unsigned | yes | — | |
| password | varchar(255) | yes | — | |
| active | int | no | 1 | |
| reset_code | varchar(255) | yes | — | |
| fcm_token | text | yes | — | Holds an Expo push token (`ExponentPushToken[…]`) despite the legacy column name |
| push_enabled | boolean | no | 1 | Added 2026_06_15 — per-user master switch for all push notifications |
| live_activity_token | varchar(255) | yes | — | Added 2026_06_20 — iOS Live Activity push-to-start token (after fcm_token) |
| remember_token | varchar(100) | yes | — | |
| created_by | bigint unsigned | yes | — | FK → users.id |
| updated_by | bigint unsigned | yes | — | FK → users.id |
| last_login | timestamp | yes | — | |
| birthdate | date | yes | — | Added 2024_03_20_022951 |
| country_id | bigint unsigned | yes | — | FK → countries.id (added 2024_03_20_022951) |
| city_id | bigint unsigned | yes | — | FK → cities.id |
| region_id | bigint unsigned | yes | — | FK → regions.id |
| created_at / updated_at | timestamp | yes | — | Timestamps |
| deleted_at | timestamp | yes | — | Soft deletes |
| provider | varchar(255) | yes | — | Added 2026_07_10 — social login: 'google' | 'apple' |
| provider_id | varchar(255) | yes | — | Added 2026_07_10 — provider account id (indexed with provider) |
| is_super_admin | boolean | no | 0 | Added 2026_06_30 — bypasses per-permission checks |
Keys / indexes
- created_by → users.id (onDelete not specified on original create; FK present)
- updated_by → users.id
- country_id → countries.id ON DELETE CASCADE
- city_id → cities.id ON DELETE CASCADE
- region_id → regions.id ON DELETE CASCADE
- UNIQUE `(phone, type)` — original `phone` unique was dropped (2025_09_20)
- UNIQUE `(email, type)` — original `email` unique was dropped (2025_09_25)
password_resets 3 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
varchar(255) | no | — | indexed | |
| token | varchar(255) | no | — | |
| created_at | timestamp | yes | — | single column, not full timestamps |
Keys / indexes
- INDEX on `email`
- No primary key.
failed_jobs 7 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK, auto-inc) | no | — | Primary key |
| uuid | varchar(255) | yes | — | UNIQUE, added 2026_04_04 (after id) |
| connection | text | no | — | |
| queue | text | no | — | |
| payload | longtext | no | — | |
| exception | longtext | no | — | |
| failed_at | timestamp | no | CURRENT_TIMESTAMP | useCurrent |
Keys / indexes
- UNIQUE on `uuid`
cache 3 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| key | varchar(255) (PK) | no | — | Primary key |
| value | mediumtext | no | — | |
| expiration | int | no | — |
cache_locks 3 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| key | varchar(255) (PK) | no | — | Primary key |
| owner | varchar(255) | no | — | |
| expiration | int | no | — |
Lookups & Geography
categories 9 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| name_ar | varchar(255) | no | — | |
| name_en | varchar(255) | yes | — | |
| icon | text | yes | — | |
| is_active | enum('0','1') | no | 1 | |
| created_by | bigint unsigned | yes | — | FK → users.id |
| updated_by | bigint unsigned | yes | — | FK → users.id |
| created_at / updated_at | timestamp | yes | — | Timestamps |
| deleted_at | timestamp | yes | — | Soft deletes |
Keys / indexes
- created_by → users.id ON DELETE CASCADE
- updated_by → users.id ON DELETE CASCADE
countries 9 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| name_ar | varchar(255) | no | — | |
| name_en | varchar(255) | yes | — | |
| code | varchar(255) | yes | — | |
| is_active | enum('0','1') | no | 0 | |
| created_by | bigint unsigned | yes | — | FK → users.id |
| updated_by | bigint unsigned | yes | — | FK → users.id |
| created_at / updated_at | timestamp | yes | — | Timestamps |
| deleted_at | timestamp | yes | — | Soft deletes |
Keys / indexes
- created_by → users.id ON DELETE CASCADE; updated_by → users.id ON DELETE CASCADE
regions 9 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| name_ar | varchar(255) | no | — | |
| name_en | varchar(255) | yes | — | |
| is_active | enum('0','1') | no | 1 | |
| country_id | bigint unsigned | yes | — | FK → countries.id |
| created_by | bigint unsigned | yes | — | FK → users.id |
| updated_by | bigint unsigned | yes | — | FK → users.id |
| created_at / updated_at | timestamp | yes | — | Timestamps |
| deleted_at | timestamp | yes | — | Soft deletes |
Keys / indexes
- country_id → countries.id ON DELETE CASCADE
- created_by / updated_by → users.id ON DELETE CASCADE
cities 9 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| name_ar | varchar(255) | no | — | |
| name_en | varchar(255) | yes | — | |
| is_active | enum('0','1') | no | 0 | |
| region_id | bigint unsigned | yes | — | FK → regions.id |
| created_by | bigint unsigned | yes | — | FK → users.id |
| updated_by | bigint unsigned | yes | — | FK → users.id |
| created_at / updated_at | timestamp | yes | — | Timestamps |
| deleted_at | timestamp | yes | — | Soft deletes |
Keys / indexes
- region_id → regions.id ON DELETE CASCADE
- created_by / updated_by → users.id ON DELETE CASCADE
service_categories 12 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| name_ar | varchar(255) | no | — | |
| name_en | varchar(255) | yes | — | |
| icon | text | yes | — | |
| type | enum('main','sub') | no | — | |
| is_active | enum('0','1') | no | 1 | |
| category_id | bigint unsigned | yes | — | FK → categories.id |
| main_service_category_id | bigint unsigned | yes | — | self FK → service_categories.id |
| created_by | bigint unsigned | yes | — | FK → users.id |
| updated_by | bigint unsigned | yes | — | FK → users.id |
| created_at / updated_at | timestamp | yes | — | Timestamps |
| deleted_at | timestamp | yes | — | Soft deletes |
Keys / indexes
- category_id → categories.id ON DELETE CASCADE
- main_service_category_id → service_categories.id ON DELETE CASCADE (self-reference)
- created_by / updated_by → users.id ON DELETE CASCADE
cancellation_reasons 8 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| reason_ar | text | no | — | |
| reason_en | text | yes | — | |
| is_active | enum('0','1') | no | 1 | |
| created_by | bigint unsigned | yes | — | FK → users.id |
| updated_by | bigint unsigned | yes | — | FK → users.id |
| created_at / updated_at | timestamp | yes | — | Timestamps |
| deleted_at | timestamp | yes | — | Soft deletes |
Keys / indexes
- created_by / updated_by → users.id ON DELETE CASCADE
client_cancellation_reasons 10 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| reason_ar | text | no | — | |
| reason_en | text | yes | — | |
| vendor_id | bigint unsigned | yes | — | FK → vendors.id, ON DELETE SET NULL (added 2026_05_26) |
| sort | tinyint | no | 0 | Added 2026_05_26 (after vendor_id) |
| is_active | enum('0','1') | no | 1 | |
| created_by | bigint unsigned | yes | — | FK → users.id |
| updated_by | bigint unsigned | yes | — | FK → users.id |
| created_at / updated_at | timestamp | yes | — | Timestamps |
| deleted_at | timestamp | yes | — | Soft deletes |
Keys / indexes
- vendor_id → vendors.id ON DELETE SET NULL
- created_by / updated_by → users.id ON DELETE CASCADE
- INDEX `ccr_vendor_active_sort_idx` on `(vendor_id, is_active, sort)`
Vendors, Branches, Employees
vendors 22 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| name | varchar(255) | no | — | |
| commercial_no | varchar(255) | no | — | |
| tax_number | varchar(255) | yes | — | |
| description | longtext | yes | — | |
| website_url | varchar(255) | yes | — | |
varchar(255) | yes | — | Retired 2026_06 — column kept, no longer read/written | |
varchar(255) | yes | — | ||
| snapchat | varchar(255) | yes | — | Retired 2026_06 — column kept, no longer read/written |
| tiktok | varchar(255) | yes | — | Added 2026_06_23 — replaces twitter/snapchat |
| is_active | enum('0','1') | no | 0 | |
| created_by | bigint unsigned | yes | — | FK → users.id |
| updated_by | bigint unsigned | yes | — | FK → users.id |
| seller_name_en | varchar(255) | yes | — | ZATCA, added 2026_01_14 |
| seller_name_ar | varchar(255) | yes | — | ZATCA |
| address | varchar(255) | yes | — | ZATCA |
| zatca_environment | enum('sandbox','production') | no | 'sandbox' | |
| zatca_registered | boolean (tinyint 1) | no | 0 (false) | |
| zatca_status | enum('not_compliant','in_progress','compliant') | no | 'not_compliant' | |
| zatca_active | boolean (tinyint 1) | no | 0 (false) | |
| created_at / updated_at | timestamp | yes | — | Timestamps |
| deleted_at | timestamp | yes | — | Soft deletes |
Keys / indexes
- created_by / updated_by → users.id ON DELETE CASCADE
vendor_categories 8 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| is_active | enum('0','1') | no | 1 | |
| vendor_id | bigint unsigned | yes | — | FK → vendors.id |
| category_id | bigint unsigned | yes | — | FK → categories.id |
| created_by | bigint unsigned | yes | — | FK → users.id |
| updated_by | bigint unsigned | yes | — | FK → users.id |
| created_at / updated_at | timestamp | yes | — | Timestamps |
| deleted_at | timestamp | yes | — | Soft deletes |
Keys / indexes
- vendor_id → vendors.id ON DELETE CASCADE; category_id → categories.id ON DELETE CASCADE
- created_by / updated_by → users.id ON DELETE CASCADE
vendor_branches 16 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| name_ar | varchar(255) | no | — | |
| name_en | varchar(255) | yes | — | |
| address | varchar(255) | yes | — | |
| image | varchar(255) | yes | — | |
| lat | varchar(255) | yes | — | |
| long | varchar(255) | yes | — | |
| is_active | enum('0','1') | no | 0 | |
| vendor_id | bigint unsigned | yes | — | FK → vendors.id |
| country_id | bigint unsigned | yes | — | FK → countries.id |
| city_id | bigint unsigned | yes | — | FK → cities.id |
| region_id | bigint unsigned | yes | — | FK → regions.id |
| created_by | bigint unsigned | yes | — | FK → users.id |
| updated_by | bigint unsigned | yes | — | FK → users.id |
| created_at / updated_at | timestamp | yes | — | Timestamps |
| deleted_at | timestamp | yes | — | Soft deletes |
Keys / indexes
- vendor_id → vendors.id; country_id → countries.id; city_id → cities.id; region_id → regions.id; created_by / updated_by → users.id — all ON DELETE CASCADE
branches 31 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| name | varchar(255) | no | — | |
| slug | varchar(255) | yes | — | indexed; added 2025_12_11 (after name) |
| address | varchar(255) | yes | — | |
| image | varchar(255) | yes | — | |
| lat | varchar(255) | yes | — | |
| long | varchar(255) | yes | — | |
| is_active | enum('0','1') | no | 0 | |
| show_rates | enum('0','1') | no | 0 | |
| manager_id | bigint unsigned | yes | — | FK → users.id |
| vendor_id | bigint unsigned | yes | — | FK → vendors.id |
| country_id | bigint unsigned | yes | — | FK → countries.id |
| city_id | bigint unsigned | yes | — | FK → cities.id |
| region_id | bigint unsigned | yes | — | FK → regions.id |
| rate | decimal(8,2) | no | 5 | Added 2025_12_10 (after region_id) |
| bookings | int | no | 0 | Added 2025_12_10 (after rate) |
| views_count | int | no | 0 | Added 2025_12_11 (after bookings) |
| national_address | varchar(255) | yes | — | Added 2025_01_06 |
| home_pricing_type | enum('fixed','by_distance') | no | 'fixed' | Added 2026_06_22 — home-delivery fee model |
| home_fixed_fee | decimal(8,2) | no | 0 | Added 2026_06_22 — flat fee when pricing = fixed |
| offers_home_services | boolean | no | 0 | Added 2026_06_23 — branch delivers to home |
| is_cloud | boolean | no | 0 | Added 2026_06_23 — home-only (cloud) branch; implies offers_home_services |
| created_by | bigint unsigned | yes | — | FK → users.id |
| updated_by | bigint unsigned | yes | — | FK → users.id |
| created_at / updated_at | timestamp | yes | — | Timestamps |
| deleted_at | timestamp | yes | — | Soft deletes |
| google_place_id | varchar(255) | yes | — | Added 2026_06_26 — linked Google Place |
| google_rating | decimal(2,1) | yes | — | Added 2026_06_26 — synced Google rating |
| google_user_ratings_total | int unsigned | yes | — | Added 2026_06_26 |
| google_synced_at | timestamp | yes | — | Added 2026_06_26 |
| show_google_reviews | boolean | no | 0 | Added 2026_06_26 — expose live Google reviews on the storefront |
Keys / indexes
- manager_id → users.id; vendor_id → vendors.id; country_id → countries.id; city_id → cities.id; region_id → regions.id; created_by / updated_by → users.id — all ON DELETE CASCADE
- INDEX on `slug`
branch_home_pricing_tiers 6 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| branch_id | bigint unsigned | no | — | FK → branches.id ON DELETE CASCADE |
| up_to_minutes | smallint unsigned | no | — | Upper bound of one-way driving minutes for this tier |
| fee | decimal(8,2) | no | 0 | Fee for trips within this tier |
| created_at / updated_at | timestamp | yes | — | Timestamps |
Keys / indexes
- Composite index
(branch_id, up_to_minutes)· Added 2026_06_22
branch_images 8 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| branch_id | bigint unsigned | no | — | FK → branches.id |
| image | varchar(255) | no | — | |
| is_active | enum('0','1') | no | 1 | |
| created_by | bigint unsigned | yes | — | FK → users.id |
| updated_by | bigint unsigned | yes | — | FK → users.id |
| created_at / updated_at | timestamp | yes | — | Timestamps |
| deleted_at | timestamp | yes | — | Soft deletes |
Keys / indexes
- branch_id → branches.id ON DELETE CASCADE; created_by / updated_by → users.id ON DELETE CASCADE
branch_views 5 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| branch_id | bigint unsigned | no | — | FK → branches.id |
| user_id | bigint unsigned | yes | — | FK → users.id |
| device_token | varchar(255) | yes | — | |
| created_at / updated_at | timestamp | yes | — | Timestamps |
Keys / indexes
- branch_id → branches.id (default FK, no explicit onDelete)
- user_id → users.id (default FK)
- No soft deletes.
favourites 7 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| branch_id | bigint unsigned | no | — | FK → branches.id |
| user_id | bigint unsigned | yes | — | FK → users.id |
| device_token | varchar(255) | yes | — | |
| created_by | bigint unsigned | yes | — | FK → users.id |
| updated_by | bigint unsigned | yes | — | FK → users.id |
| created_at / updated_at | timestamp | yes | — | Timestamps |
Keys / indexes
- branch_id → branches.id; user_id → users.id; created_by → users.id; updated_by → users.id (default FKs, no explicit onDelete)
- No soft deletes.
official_hours 12 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| start_time | time | no | — | |
| end_time | time | no | — | |
| day | varchar(255) | no | — | |
| type | enum('work','break') | no | 'work' | |
| model_type | tinyint | no | — | polymorphic discriminator |
| is_active | enum('0','1') | no | 1 | |
| model_id | bigint unsigned | yes | — | polymorphic id (no FK) |
| created_by | bigint unsigned | yes | — | FK → users.id |
| updated_by | bigint unsigned | yes | — | FK → users.id |
| created_at / updated_at | timestamp | yes | — | Timestamps |
| deleted_at | timestamp | yes | — | Soft deletes |
Keys / indexes
- created_by / updated_by → users.id ON DELETE CASCADE
employees 17 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| user_id | bigint unsigned | no | — | FK → users.id |
| vendor_id | bigint unsigned | no | — | FK → vendors.id |
| salary | decimal(8,2) | yes | — | default Laravel decimal precision (8,2) |
| start_date | date | yes | — | |
| end_date | date | yes | — | |
| is_active | enum('0','1') | no | 1 | |
| created_by | bigint unsigned | yes | — | FK → users.id |
| updated_by | bigint unsigned | yes | — | FK → users.id |
| job_title | varchar(255) | yes | — | Added 2024_09_06 |
| bio | text | yes | — | Added 2026_05_28 — replaces earlier bio_ar/bio_en split (unified 2026_05_29) |
| commission_type | enum('none','fixed','percentage') | no | 'none' | Added 2025_11_25 |
| commission | decimal(8,2) | no | 0 | Added 2025_11_25 |
| commission_calculation_method | enum('gross','net') | no | 'gross' | Added 2025_11_25 |
| created_at / updated_at | timestamp | yes | — | Timestamps |
| deleted_at | timestamp | yes | — | Soft deletes |
| google_calendar_id | varchar(255) | yes | — | Added 2026_06_28 — employee's dedicated Google calendar |
Keys / indexes
- vendor_id → vendors.id ON DELETE CASCADE; user_id → users.id ON DELETE CASCADE; created_by / updated_by → users.id ON DELETE CASCADE
employee_portfolio_images 10 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| employee_id | bigint unsigned | no | — | FK → employees.id |
| image | varchar(255) | no | — | Storage path (e.g. images/employees/portfolio/<file>) |
| caption | text | yes | — | Optional lightbox label |
| sort | tinyint unsigned | no | 0 | Display order (lowest first) |
| is_active | enum('0','1') | no | 1 | Toggle visibility to customers |
| created_by | bigint unsigned | yes | — | FK → users.id |
| updated_by | bigint unsigned | yes | — | FK → users.id |
| created_at / updated_at | timestamp | yes | — | Timestamps |
| deleted_at | timestamp | yes | — | Soft deletes |
Keys / indexes
- employee_id → employees.id ON DELETE CASCADE; created_by / updated_by → users.id ON DELETE CASCADE
- Composite index
(employee_id, is_active, sort)for the customer profile hot-path - Added 2026_05_28
employee_services 7 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| employee_id | bigint unsigned | no | — | FK → employees.id |
| service_id | bigint unsigned | no | — | FK → services.id |
| is_active | enum('0','1') | no | 1 | |
| created_by | bigint unsigned | yes | — | FK → users.id |
| updated_by | bigint unsigned | yes | — | FK → users.id |
| created_at / updated_at | timestamp | yes | — | Timestamps (NO soft deletes) |
Keys / indexes
- service_id → services.id ON DELETE CASCADE; employee_id → employees.id ON DELETE CASCADE; created_by / updated_by → users.id ON DELETE CASCADE
employee_branches 7 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| employee_id | bigint unsigned | no | — | FK → employees.id |
| branch_id | bigint unsigned | no | — | FK → branches.id |
| is_active | enum('0','1') | no | 1 | |
| created_by | bigint unsigned | yes | — | FK → users.id |
| updated_by | bigint unsigned | yes | — | FK → users.id |
| created_at / updated_at | timestamp | yes | — | Timestamps (NO soft deletes) |
Keys / indexes
- branch_id → branches.id ON DELETE CASCADE; employee_id → employees.id ON DELETE CASCADE; created_by / updated_by → users.id ON DELETE CASCADE
Sections, Services, Offers
sections 13 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| name_ar | varchar(255) | no | — | |
| name_en | varchar(255) | yes | — | |
| description_ar | longtext | yes | — | |
| description_en | longtext | yes | — | |
| image | varchar(255) | yes | — | Made nullable in 2025_05_26 |
| is_active | enum('0','1') | no | 1 | |
| sort | int | no | 0 | Added 2026_05_20 (after is_active) |
| vendor_id | bigint unsigned | no | — | FK → vendors.id |
| created_by | bigint unsigned | yes | — | FK → users.id |
| updated_by | bigint unsigned | yes | — | FK → users.id |
| created_at / updated_at | timestamp | yes | — | Timestamps |
| deleted_at | timestamp | yes | — | Soft deletes |
Keys / indexes
- vendor_id → vendors.id ON DELETE CASCADE; created_by / updated_by → users.id ON DELETE CASCADE
services 24 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| name_ar | varchar(255) | no | — | |
| name_en | varchar(255) | yes | — | |
| description_ar | longtext | yes | — | |
| description_en | longtext | yes | — | |
| vendor_id | bigint unsigned | no | — | FK → vendors.id |
| section_id | bigint unsigned | no | — | FK → sections.id |
| category_id | bigint unsigned | yes | — | FK → service_categories.id. Made nullable 2025_05_12 |
| sub_category_id | bigint unsigned | yes | — | FK → service_categories.id |
| price | decimal(8,2) | yes | — | |
| service_time | decimal(8,2) | yes | — | |
| extra_time | decimal(8,2) | yes | — | |
| featured | enum('0','1') | no | 0 | |
| is_home_service | boolean (tinyint 1) | no | 0 (false) | Added 2026_05_25 (after featured) |
| home_service_fee | decimal(8,2) | no | 0 | Added 2026_05_25 (after is_home_service) |
| home_only | boolean | no | 0 | Added 2026_06_23 — hide from in-branch storefront, home mode only |
| discount_type | enum('0','1') | no | 0 | |
| discount | decimal(8,2) | yes | — | |
| is_active | enum('0','1') | no | 1 | |
| sort | int | no | 0 | Added 2026_05_20 (after is_active) |
| created_by | bigint unsigned | yes | — | FK → users.id |
| updated_by | bigint unsigned | yes | — | FK → users.id |
| created_at / updated_at | timestamp | yes | — | Timestamps |
| deleted_at | timestamp | yes | — | Soft deletes |
Keys / indexes
- vendor_id → vendors.id; section_id → sections.id; category_id → service_categories.id; sub_category_id → service_categories.id; created_by / updated_by → users.id — all ON DELETE CASCADE
service_branches 8 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| service_id | bigint unsigned | no | — | FK → services.id |
| branch_id | bigint unsigned | no | — | FK → branches.id |
| is_active | enum('0','1') | no | 1 | |
| created_by | bigint unsigned | yes | — | FK → users.id |
| updated_by | bigint unsigned | yes | — | FK → users.id |
| created_at / updated_at | timestamp | yes | — | Timestamps |
| deleted_at | timestamp | yes | — | Soft deletes added 2025_12_25 |
Keys / indexes
- branch_id → branches.id ON DELETE CASCADE; service_id → services.id ON DELETE CASCADE; created_by / updated_by → users.id ON DELETE CASCADE
service_home_hours 6 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| service_id | bigint unsigned | no | — | FK → services.id |
| day | enum('sat','sun','mon','tue','wed','thu','fri') | no | — | |
| start_time | time | no | — | |
| end_time | time | no | — | |
| created_at / updated_at | timestamp | yes | — | Timestamps (NO soft deletes) |
Keys / indexes
- service_id → services.id ON DELETE CASCADE
- INDEX `svc_home_hours_svc_day_idx` on `(service_id, day)`
offers 22 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| name_ar | varchar(255) | no | — | |
| name_en | varchar(255) | yes | — | |
| description_en | longtext | yes | — | |
| description_ar | longtext | yes | — | |
| vendor_id | bigint unsigned | yes | — | FK → vendors.id |
| section_id | bigint unsigned | no | — | FK → sections.id |
| category_id | bigint unsigned | yes | — | FK → service_categories.id. Made nullable 2025_06_04 |
| sub_category_id | bigint unsigned | yes | — | FK → service_categories.id |
| service_price | decimal(10,2) | yes | — | |
| price_type | enum('service','free','special','discount') | no | 'service' | |
| discount_percentage | decimal(8,2) | yes | — | |
| offer_price | decimal(8,2) | yes | — | |
| is_home_service | boolean | no | 0 | Added 2026_05_30 — home-delivery opt-in (after offer_price) |
| home_service_fee | decimal(8,2) | no | 0 | Added 2026_05_30 — additive per-item home surcharge (summed across the bundle) |
| home_only | boolean | no | 0 | Added 2026_06_23 — hide from in-branch storefront, home mode only |
| is_active | enum('0','1') | no | 1 | |
| sort | int | no | 0 | Added 2026_05_20 (after is_active) |
| created_by | bigint unsigned | yes | — | FK → users.id |
| updated_by | bigint unsigned | yes | — | FK → users.id |
| deleted_at | timestamp | yes | — | Soft deletes |
| created_at / updated_at | timestamp | yes | — | Timestamps |
Keys / indexes
- vendor_id → vendors.id; section_id → sections.id; category_id → service_categories.id; sub_category_id → service_categories.id; created_by / updated_by → users.id — all ON DELETE CASCADE
offer_home_hours 6 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| offer_id | bigint unsigned | no | — | FK → offers.id ON DELETE CASCADE |
| day | enum('sat','sun','mon','tue','wed','thu','fri') | no | — | |
| start_time | time | no | — | |
| end_time | time | no | — | |
| created_at / updated_at | timestamp | yes | — | Timestamps (NO soft deletes) |
Keys / indexes
- Composite index
(offer_id, day)· Added 2026_05_30 (mirror ofservice_home_hours)
sub_services 13 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| service_id | bigint unsigned | no | — | FK → services.id ON DELETE CASCADE |
| name_ar | varchar(255) | no | — | |
| name_en | varchar(255) | yes | — | |
| price | decimal(8,2) | no | — | Variant price |
| service_time | decimal | no | — | Variant duration (minutes) |
| extra_time | decimal | yes | — | Buffer minutes |
| sort | int | no | 0 | |
| is_active | enum('0','1') | no | 1 | |
| created_by | bigint unsigned | yes | — | FK → users.id |
| updated_by | bigint unsigned | yes | — | FK → users.id |
| created_at / updated_at | timestamp | yes | — | Timestamps |
| deleted_at | timestamp | yes | — | Soft deletes |
Keys / indexes
- Composite index
(service_id, sort)· Added 2026_06_25 — per-service variants (sub-services)
vendor_google_calendars 9 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| vendor_id | bigint unsigned | no | — | UNIQUE — one connection per vendor |
| google_email | varchar(255) | yes | — | |
| access_token | text | yes | — | OAuth token |
| refresh_token | text | yes | — | |
| token_expires_at | timestamp | yes | — | |
| default_calendar_id | varchar(255) | yes | — | |
| sync_enabled | boolean | no | 1 | |
| created_at / updated_at | timestamp | yes | — | Timestamps |
Keys / indexes
- Added 2026_06_28 — two-way Google Calendar sync
google_review_snapshots 17 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| branch_id | bigint unsigned | no | — | UNIQUE FK → branches.id |
| place_id | varchar(255) | no | — | |
| place_name | varchar(255) | yes | — | |
| total_score | decimal(2,1) | yes | — | Google rating |
| reviews_count | int unsigned | yes | — | |
| reviews | json | yes | — | Raw review payloads |
| fetched_at | timestamp | yes | — | |
| category | varchar(255) | yes | — | Added 2026_06_29 (competitors) |
| lat | decimal(10,7) | yes | — | |
| lng | decimal(10,7) | yes | — | |
| competitors | json | yes | — | Nearby competitor list |
| employee_mentions | json | yes | — | Mined employee mentions from reviews |
| employee_mentions_at | timestamp | yes | — | |
| competitor_insights | json | yes | — | AI competitor insights |
| competitor_insights_at | timestamp | yes | — | |
| created_at / updated_at | timestamp | yes | — | Timestamps |
Keys / indexes
- Added 2026_06_29 (+3 follow-ups) — Google review intelligence per branch
integrations 11 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| key | varchar(255) | no | — | UNIQUE slug (whatsapp, oursms, google, apify, live_activity, gemini) |
| name | varchar(255) | no | — | |
| group | varchar(255) | yes | — | messaging | maps | reviews | push | ai |
| config_key | varchar(255) | yes | — | Dot-path config overlay |
| icon | varchar(255) | yes | — | |
| fields | json | yes | — | [{key, label, secret, required}] |
| credentials | text | yes | — | Encrypted array |
| is_active | boolean | no | 1 | |
| sort | int | no | 0 | |
| created_at / updated_at | timestamp | yes | — | Timestamps |
Keys / indexes
- Added 2026_06_30 — admin-managed third-party integrations
default_sections 9 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| name_ar | varchar(255) | no | — | |
| name_en | varchar(255) | yes | — | |
| description_ar | text | yes | — | |
| description_en | text | yes | — | |
| sort | int | no | 0 | |
| is_active | boolean | no | 1 | |
| deleted_at | timestamp | yes | — | Soft deletes (added 2026_06_30) |
| created_at / updated_at | timestamp | yes | — | Timestamps |
Keys / indexes
- Added 2026_06_30 — section templates seeded into new vendors (was hardcoded)
popular_services 9 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| name_ar | varchar(255) | no | — | |
| name_en | varchar(255) | yes | — | |
| description_ar | text | yes | — | |
| description_en | text | yes | — | |
| sort | int | no | 0 | |
| is_active | boolean | no | 1 | |
| deleted_at | timestamp | yes | — | Soft deletes (added 2026_06_30) |
| created_at / updated_at | timestamp | yes | — | Timestamps |
Keys / indexes
- Added 2026_06_30 — popular-service templates for the mobile create-service picker
offer_services 7 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| offer_id | bigint unsigned | no | — | FK → offers.id |
| service_id | bigint unsigned | no | — | FK → services.id |
| created_by | bigint unsigned | yes | — | FK → users.id |
| updated_by | bigint unsigned | yes | — | FK → users.id |
| created_at / updated_at | timestamp | yes | — | Timestamps (NO soft deletes) |
| sub_service_id | bigint unsigned | yes | — | Added 2026_06_25 — variant pinned in the offer; FK → sub_services.id ON DELETE SET NULL |
Keys / indexes
- offer_id → offers.id ON DELETE CASCADE; service_id → services.id ON DELETE CASCADE; created_by / updated_by → users.id ON DELETE CASCADE
Bookings & Reviews
bookings 40 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| attendance | enum('0','1') | no | 1 | |
| booking_day | date | yes | — | |
| booking_time | time | yes | — | |
| start_time | timestamp | yes | — | Added 2025_07_10 (after booking_time) |
| end_time | timestamp | yes | — | Added 2025_07_10 (after start_time) |
| future_booking | enum('0','1') | no | '0' | Added 2025_11_17 (after end_time) |
| sub_total | decimal(8,2) | no | 0 | |
| discount | decimal(8,2) | no | 0 | |
| total | decimal(8,2) | no | 0 | |
| vat | decimal(8,2) | no | — | Added 2025_07_16 (after total), NOT NULL no default |
| employee_commission | decimal(8,2) | no | 0 | Added 2025_11_26 (after vat) |
| status | enum('confirmed','not_confirmed','completed','not_available','canceled','missed') | no | 'not_confirmed' | See history note below |
| payment_way | enum('online','cash') | no | 'cash' | |
| promo_code_value | decimal(8,2) | yes | — | Renamed from `promocode_value` (2025_06_16) |
| promo_code_id | bigint unsigned | yes | — | Renamed from `promocode_id`; FK → promo_codes.id |
| notes | longtext | yes | — | |
| cancellation_reason | text | yes | — | Added 2026_05_25 (after notes) |
| canceled_by | enum('customer','vendor','system') | yes | — | Added 2026_05_25 (after cancellation_reason) |
| cancel_reason_id | bigint unsigned | yes | — | FK → client_cancellation_reasons.id, ON DELETE SET NULL (added 2026_05_26, after canceled_by) |
| is_home_service | boolean (tinyint 1) | no | 0 (false) | Added 2026_05_25 (after canceled_by) |
| customer_lat | decimal(10,7) | yes | — | Added 2026_05_25 |
| customer_lng | decimal(10,7) | yes | — | Added 2026_05_25 |
| transit_minutes | int unsigned | yes | — | Added 2026_05_25 |
| customer_address | varchar(500) | yes | — | Added 2026_05_25 |
| vendor_id | bigint unsigned | no | — | FK → vendors.id |
| user_id | bigint unsigned | yes | — | FK → users.id. Made nullable 2025_09_12 |
| offer_id | bigint unsigned | yes | — | FK → offers.id |
| employee_id | bigint unsigned | yes | — | FK → employees.id |
| branch_id | bigint unsigned | yes | — | Added 2024_05_11 (no FK declared) |
| customer_invoice | bigint unsigned | yes | — | Added 2024_05_11 (no FK) |
| vendor_invoice | bigint unsigned | yes | — | Added 2024_05_11 (no FK) |
| confirmation | enum('confirmed','not_confirmed') | no | 'confirmed' | Added 2024_12_10 |
| created_by | bigint unsigned | yes | — | FK → users.id |
| updated_by | bigint unsigned | yes | — | FK → users.id |
| payment_status | enum('0','1') | no | 0 | |
| is_active | enum('0','1') | no | 1 | |
| created_at / updated_at | timestamp | yes | — | Timestamps |
| deleted_at | timestamp | yes | — | Soft deletes |
| google_event_id | varchar(255) | yes | — | Added 2026_06_28 — synced Google Calendar event |
Keys / indexes
- promo_code_id → promo_codes.id ON DELETE CASCADE
- vendor_id → vendors.id ON DELETE CASCADE
- offer_id → offers.id ON DELETE CASCADE
- user_id → users.id ON DELETE CASCADE
- employee_id → employees.id ON DELETE CASCADE
- cancel_reason_id → client_cancellation_reasons.id ON DELETE SET NULL
- created_by / updated_by → users.id ON DELETE CASCADE
- NOTE: `branch_id`, `customer_invoice`, `vendor_invoice` are plain columns with NO foreign key constraints.
booking_services 12 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| booking_id | bigint unsigned | no | — | FK → bookings.id |
| service_id | bigint unsigned | no | — | FK → services.id |
| offer_id | bigint unsigned | yes | — | FK → offers.id (added 2025_07_15, after service_id) |
| price | decimal(8,2) | no | 0 | |
| vat | double | no | — | Added 2025_07_15 (after price), NOT NULL no default |
| created_by | bigint unsigned | yes | — | FK → users.id |
| updated_by | bigint unsigned | yes | — | FK → users.id |
| deleted_at | timestamp | yes | — | Soft deletes |
| created_at / updated_at | timestamp | yes | — | Timestamps |
| sub_service_id | bigint unsigned | yes | — | Added 2026_06_25 — chosen variant; FK → sub_services.id ON DELETE SET NULL |
| service_time | int unsigned | yes | — | Added 2026_07_07 — per-line duration override (minutes) |
Keys / indexes
- service_id → services.id ON DELETE CASCADE; booking_id → bookings.id ON DELETE CASCADE; created_by / updated_by → users.id ON DELETE CASCADE
- offer_id → offers.id (no explicit onDelete)
booking_updates 7 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| booking_id | bigint unsigned | no | — | FK → bookings.id |
| status | varchar(255) | no | — | |
| created_by | bigint unsigned | yes | — | FK → users.id |
| updated_by | bigint unsigned | yes | — | FK → users.id |
| created_at / updated_at | timestamp | yes | — | Timestamps |
| deleted_at | timestamp | yes | — | Soft deletes |
Keys / indexes
- booking_id → bookings.id; created_by → users.id; updated_by → users.id (default FKs, no explicit onDelete)
reviews 9 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| employee_rate | tinyint | no | 1 | |
| employee_comment | text | yes | — | |
| booking_id | bigint unsigned | no | — | FK → bookings.id |
| created_by | bigint unsigned | yes | — | FK → users.id |
| updated_by | bigint unsigned | yes | — | FK → users.id |
| is_active | enum('0','1') | no | 1 | |
| created_at / updated_at | timestamp | yes | — | Timestamps |
| deleted_at | timestamp | yes | — | Soft deletes |
Keys / indexes
- booking_id → bookings.id ON DELETE CASCADE; created_by / updated_by → users.id ON DELETE CASCADE
review_reports 8 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| comment | text | yes | — | |
| review_id | bigint unsigned | no | — | FK → reviews.id |
| created_by | bigint unsigned | yes | — | FK → users.id |
| updated_by | bigint unsigned | yes | — | FK → users.id |
| is_active | enum('0','1') | no | 1 | |
| created_at / updated_at | timestamp | yes | — | Timestamps |
| deleted_at | timestamp | yes | — | Soft deletes |
Keys / indexes
- review_id → reviews.id ON DELETE CASCADE; created_by / updated_by → users.id ON DELETE CASCADE
Invoicing & ZATCA
tax_invoices 13 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| type | enum('service','product') | no | — | |
| cost | float | yes | — | |
| booking_id | bigint unsigned | yes | — | FK → bookings.id |
| product_id | bigint unsigned | yes | — | no FK |
| name | varchar(255) | yes | — | |
varchar(255) | yes | — | ||
| phone | varchar(255) | yes | — | |
| created_by | bigint unsigned | yes | — | FK → users.id |
| updated_by | bigint unsigned | yes | — | FK → users.id |
| is_active | enum('0','1') | no | 1 | |
| created_at / updated_at | timestamp | yes | — | Timestamps |
| deleted_at | timestamp | yes | — | Soft deletes |
Keys / indexes
- booking_id → bookings.id ON DELETE CASCADE; created_by / updated_by → users.id ON DELETE CASCADE
invoices 32 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| uuid | char(36) | no | — | UNIQUE (Laravel `uuid()` default column name `uuid`) |
| invoice_number | varchar(255) | no | — | UNIQUE |
| document_type | varchar(20) | no | 'invoice' | Added 2026_06_24 — invoice | credit_note | debit_note |
| reference_invoice_id | bigint unsigned | yes | — | Added 2026_06_24 — original invoice a note adjusts |
| note_reason | varchar(255) | yes | — | Added 2026_06_24 — reason for credit/debit note |
| buyer_name | varchar(255) | no | — | |
| buyer_vat_number | varchar(255) | yes | — | |
| seller_name | varchar(255) | no | — | |
| seller_vat_number | varchar(255) | yes | — | |
| total | decimal(8,2) | no | — | |
| vat | decimal(8,2) | no | — | |
| qr_code_base64 | longtext | no | — | |
| type | enum('customer','vendor') | no | — | |
| booking_id | bigint unsigned | yes | — | FK → bookings.id |
| vendor_id | bigint unsigned | no | — | FK → vendors.id |
| zatca_status | enum('pending','skipped','reported','cleared','failed') | no | 'pending' | Added 2026_05_25 (after vendor_id); INDEXED |
| zatca_environment | enum('sandbox','production') | yes | — | |
| icv | int unsigned | yes | — | per-vendor counter |
| pih | varchar(100) | yes | — | previous invoice hash |
| hash | varchar(100) | yes | — | this invoice hash |
| zatca_uuid | char(36) | yes | — | |
| signed_xml | longtext | yes | — | |
| zatca_qr_base64 | longtext | yes | — | |
| zatca_response | json | yes | — | |
| zatca_warnings | json | yes | — | |
| zatca_errors | json | yes | — | |
| zatca_attempts | tinyint unsigned | no | 0 | |
| cleared_at | timestamp | yes | — | |
| created_by | bigint unsigned | yes | — | FK → users.id |
| updated_by | bigint unsigned | yes | — | FK → users.id |
| created_at / updated_at | timestamp | yes | — | Timestamps (NO soft deletes) |
Keys / indexes
- booking_id → bookings.id; vendor_id → vendors.id; created_by / updated_by → users.id — all ON DELETE CASCADE
- UNIQUE on `uuid`; UNIQUE on `invoice_number`
- UNIQUE `invoices_vendor_icv_unique` on `(vendor_id, icv)`
- INDEX on `zatca_status`
zatca_egs 6 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| vendor_id | bigint unsigned | no | — | FK → vendors.id |
| environment | enum('sandbox','production') | no | 'sandbox' | |
| csr | longtext | no | — | |
| private_key | longtext | no | — | |
| created_at / updated_at | timestamp | yes | — | Timestamps |
Keys / indexes
- vendor_id → vendors.id (default FK, no explicit onDelete)
zatca_credentials 8 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| egs_id | bigint unsigned | no | — | FK → zatca_egs.id |
| request_id | bigint | no | — | signed bigint |
| certificate | longtext | no | — | |
| api_secret | longtext | no | — | |
| icv | int | yes | — | |
| pih | varchar(255) | yes | — | |
| created_at / updated_at | timestamp | yes | — | Timestamps |
Keys / indexes
- egs_id → zatca_egs.id (default FK, no explicit onDelete)
Wallets & Promotions
wallets 8 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| user_id | bigint unsigned | no | — | FK → users.id |
| balance | float | no | 0 | |
| is_active | enum('0','1') | no | 1 | |
| created_by | bigint unsigned | yes | — | FK → users.id |
| updated_by | bigint unsigned | yes | — | FK → users.id |
| created_at / updated_at | timestamp | yes | — | Timestamps |
| deleted_at | timestamp | yes | — | Soft deletes |
Keys / indexes
- user_id → users.id ON DELETE CASCADE; created_by / updated_by → users.id ON DELETE CASCADE
wallet_transactions 13 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| wallet_id | bigint unsigned | no | — | FK → wallets.id |
| value | float | no | 0 | |
| description_en | text | yes | — | Renamed from `description` (2025_09_23) |
| description_ar | text | yes | — | Added 2025_09_23 |
| type | enum('debit','credit') | no | 'debit' | |
| is_active | enum('0','1') | no | 1 | |
| created_by | bigint unsigned | yes | — | FK → users.id |
| updated_by | bigint unsigned | yes | — | FK → users.id |
| branch_id | bigint unsigned | yes | — | FK → branches.id (added 2025_01_06) |
| booking_id | bigint unsigned | yes | — | FK → bookings.id (added 2025_11_24) |
| created_at / updated_at | timestamp | yes | — | Timestamps |
| deleted_at | timestamp | yes | — | Soft deletes |
Keys / indexes
- wallet_id → wallets.id ON DELETE CASCADE; created_by / updated_by → users.id ON DELETE CASCADE
- branch_id → branches.id ON DELETE CASCADE; booking_id → bookings.id ON DELETE CASCADE
promo_codes 15 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| discount_type | enum('percentage','fixed') | no | 'percentage' | |
| category_type | enum('public','private') | no | 'public' | |
| value | float | no | 1 | |
| code | varchar(255) | no | — | |
| start_date | varchar(255) | no | — | stored as string |
| end_date | varchar(255) | no | — | stored as string |
| user_id | bigint unsigned | yes | — | FK → users.id |
| uses | int | no | 1 | |
| actual_uses | int | no | 0 | Added 2026_03_04 (after uses) |
| is_active | enum('0','1') | no | 1 | |
| created_by | bigint unsigned | yes | — | FK → users.id |
| updated_by | bigint unsigned | yes | — | FK → users.id |
| created_at / updated_at | timestamp | yes | — | Timestamps |
| deleted_at | timestamp | yes | — | Soft deletes |
Keys / indexes
- user_id → users.id ON DELETE CASCADE; created_by / updated_by → users.id ON DELETE CASCADE
Packages & Subscriptions
packages 32 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| name_ar | varchar(255) | no | — | |
| name_en | varchar(255) | yes | — | |
| description_ar | text | no | — | |
| description_en | text | yes | — | |
| period | enum('unknown','days','month','quarter','half_year','year') | no | 'unknown' | |
| days | int | yes | — | |
| unknown_price | float | no | 0 | |
| days_price | float | no | 0 | |
| month_price | float | no | 0 | |
| quarter_price | float | no | 0 | |
| half_year_price | float | no | 0 | |
| year_price | float | no | 0 | |
| type | enum('public','private') | no | 'public' | |
| manager_role_id | bigint unsigned | yes | — | no FK |
| subscription_type | enum('subscribe','commission','subscribe_and_commission') | no | 'subscribe' | |
| commission | float | no | 0 | |
| features | text | yes | — | |
| sms_messages | int | no | 0 | |
| whatsapp_messages | int | no | 0 | |
| is_default | enum('0','1') | no | 1 | |
| policy | text | yes | — | |
| is_active | enum('0','1') | no | 1 | |
| created_by | bigint unsigned | yes | — | FK → users.id |
| updated_by | bigint unsigned | yes | — | FK → users.id |
| branches | int | no | 1 | Added 2024_03_31 |
| employees | int | no | 1 | Added 2024_03_31 |
| customers | int | no | 1 | Added 2024_03_31 |
| payments | enum('cash','percentage','cash_and_percentage') | no | 'cash' | Added 2024_03_31; enum expanded 2025_01_06 |
| remove_copy_right | enum('0','1') | no | 0 | Added 2024_03_31 |
| created_at / updated_at | timestamp | yes | — | Timestamps |
| deleted_at | timestamp | yes | — | Soft deletes |
Keys / indexes
- created_by / updated_by → users.id ON DELETE CASCADE
subscriptions 27 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| name_ar | varchar(255) | no | — | |
| package_id | bigint unsigned | no | — | FK → packages.id |
| vendor_id | bigint unsigned | no | — | FK → vendors.id |
| period | enum('unknown','days','month','quarter','half_year','year') | no | 'unknown' | |
| subscription_type | enum('subscribe','commission','subscribe_and_commission') | no | 'subscribe' | |
| days | int | yes | — | |
| price | float | no | 0 | |
| start_date | varchar(255) | yes | — | string |
| end_date | varchar(255) | yes | — | string |
| payment_date | varchar(255) | yes | — | string |
| commission | float | no | 0 | |
| sms_messages | int | no | 0 | |
| whatsapp_messages | int | no | 0 | |
| auto_renew | enum('0','1') | no | 1 | |
| status | enum('pending','wait_payment','cancelled','finished','expanded','renewed','suspended','active') | no | 'pending' | |
| is_active | enum('0','1') | no | 1 | |
| created_by | bigint unsigned | yes | — | FK → users.id |
| updated_by | bigint unsigned | yes | — | FK → users.id |
| branches | int | no | 1 | Added 2024_03_31 |
| employee | int | no | 1 | Added 2024_03_31 (note: singular `employee`) |
| customers | int | no | 1 | Added 2024_03_31 |
| payments | enum('cash','percentage','cash_and_percentage') | no | 'cash' | Added 2024_03_31; enum expanded 2025_05_11 |
| remove_copy_right | enum('0','1') | no | 0 | Added 2024_03_31 |
| created_at / updated_at | timestamp | yes | — | Timestamps |
| deleted_at | timestamp | yes | — | Soft deletes |
| features | json | yes | — | Added 2026_06_30 — feature keys copied from the package at purchase (gates checkFeature middleware) |
Keys / indexes
- package_id → packages.id ON DELETE CASCADE; vendor_id → vendors.id ON DELETE CASCADE; created_by / updated_by → users.id ON DELETE CASCADE
Settings
payment_settings 8 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| online_payment | enum('0','1') | no | 1 | |
| online_on_delivery_payment | enum('0','1') | no | 1 | |
| is_active | enum('0','1') | no | 1 | |
| created_by | bigint unsigned | yes | — | FK → users.id |
| updated_by | bigint unsigned | yes | — | FK → users.id |
| created_at / updated_at | timestamp | yes | — | Timestamps |
| deleted_at | timestamp | yes | — | Soft deletes |
Keys / indexes
- created_by / updated_by → users.id ON DELETE CASCADE
service_settings 7 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| difference_in_min | int | no | 15 | |
| is_active | enum('0','1') | no | 1 | |
| created_by | bigint unsigned | yes | — | FK → users.id |
| updated_by | bigint unsigned | yes | — | FK → users.id |
| created_at / updated_at | timestamp | yes | — | Timestamps |
| deleted_at | timestamp | yes | — | Soft deletes |
Keys / indexes
- created_by / updated_by → users.id ON DELETE CASCADE
tax_settings 7 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| tax_percentage | int | no | 0 | |
| is_active | enum('0','1') | no | 1 | |
| created_by | bigint unsigned | yes | — | FK → users.id |
| updated_by | bigint unsigned | yes | — | FK → users.id |
| created_at / updated_at | timestamp | yes | — | Timestamps |
| deleted_at | timestamp | yes | — | Soft deletes |
Keys / indexes
- created_by / updated_by → users.id ON DELETE CASCADE
notification_settings 10 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
enum('0','1') | no | 1 | ||
| sms | enum('0','1') | no | 1 | |
enum('0','1') | no | 1 | ||
| is_active | enum('0','1') | no | 1 | |
| created_by | bigint unsigned | yes | — | FK → users.id |
| updated_by | bigint unsigned | yes | — | FK → users.id |
| created_at / updated_at | timestamp | yes | — | Timestamps |
| deleted_at | timestamp | yes | — | Soft deletes |
| push | varchar(255) | no | 1 | Added 2026_06_30 — platform-level push channel toggle |
Keys / indexes
- created_by / updated_by → users.id ON DELETE CASCADE
user_notification_settings 9 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
enum('0','1') | no | 1 | ||
| sms | enum('0','1') | no | 1 | |
enum('0','1') | no | 1 | ||
| is_active | enum('0','1') | no | 1 | |
| created_by | bigint unsigned | yes | — | FK → users.id |
| updated_by | bigint unsigned | yes | — | FK → users.id |
| created_at / updated_at | timestamp | yes | — | Timestamps |
| deleted_at | timestamp | yes | — | Soft deletes |
Keys / indexes
- created_by / updated_by → users.id ON DELETE CASCADE
language_settings 8 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| default | enum('en','ar') | no | 'ar' | |
| is_active | enum('0','1') | no | 1 | |
| created_by | bigint unsigned | yes | — | FK → users.id |
| updated_by | bigint unsigned | yes | — | FK → users.id |
| user_id | bigint unsigned | yes | — | Added 2024_03_28 (no FK) |
| created_at / updated_at | timestamp | yes | — | Timestamps |
| deleted_at | timestamp | yes | — | Soft deletes |
Keys / indexes
- created_by / updated_by → users.id ON DELETE CASCADE. `user_id` has NO FK.
vendor_settings 18 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| stock_alert | tinyint | no | 1 | |
| calender_differance | tinyint | no | 10 | |
| calender_differance_type | enum('fixed','vary') | no | 'fixed' | |
| booking_differance | tinyint | no | 30 | Default changed from 1 → 30 (2025_05_07) |
| booking_range | enum('one_month',...,'twelve_month') | no | 'one_month' | 12 values: one_month, two_month, three_month, four_month, five_month, six_month, seven_month, eight_month, nine_month, ten_month, eleven_month, twelve_month |
| cancel_booking | tinyint | no | 1 | |
| reschedule_booking | tinyint | no | 1 | |
| reviews_enabled | tinyint | no | 1 | Added 2026_05_26 (after reschedule_booking) |
| vendor_id | bigint unsigned | yes | — | FK → vendors.id |
| is_system | enum('0','1') | no | 0 | |
| is_active | enum('0','1') | no | 1 | |
| created_by | bigint unsigned | yes | — | FK → users.id |
| updated_by | bigint unsigned | yes | — | FK → users.id |
| accept_payment | enum('cash','online','both') | no | 'both' | Added 2024_09_21 |
| created_at / updated_at | timestamp | yes | — | Timestamps |
| deleted_at | timestamp | yes | — | Soft deletes |
| google_reviews_min_stars | tinyint unsigned | no | 5 | Added 2026_06_27 — hide storefront Google reviews below this rating |
Keys / indexes
- vendor_id → vendors.id ON DELETE CASCADE; created_by / updated_by → users.id ON DELETE CASCADE
Content & Misc
system_notifications 12 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| message | text | no | — | |
| sender_id | bigint unsigned | yes | — | FK → users.id |
| receiver_id | bigint unsigned | yes | — | FK → users.id |
| url | varchar(255) | yes | — | |
| is_read | enum('0','1') | no | 0 | |
| is_active | enum('0','1') | no | 1 | |
| is_system | enum('0','1') | no | 0 | |
| created_by | bigint unsigned | yes | — | FK → users.id |
| updated_by | bigint unsigned | yes | — | FK → users.id |
| created_at / updated_at | timestamp | yes | — | Timestamps |
| deleted_at | timestamp | yes | — | Soft deletes |
Keys / indexes
- sender_id / receiver_id / created_by / updated_by → users.id ON DELETE CASCADE
help_centers 10 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| title | varchar(255) | no | — | |
| description | text | yes | — | |
| image | text | yes | — | |
| video | text | no | — | NOT NULL |
| is_active | enum('0','1') | no | 1 | |
| created_by | bigint unsigned | yes | — | FK → users.id |
| updated_by | bigint unsigned | yes | — | FK → users.id |
| created_at / updated_at | timestamp | yes | — | Timestamps |
| deleted_at | timestamp | yes | — | Soft deletes |
Keys / indexes
- created_by / updated_by → users.id ON DELETE CASCADE
term_conditions 9 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| content | longtext | no | — | |
| is_active | enum('0','1') | no | 1 | |
| created_by | bigint unsigned | yes | — | FK → users.id |
| updated_by | bigint unsigned | yes | — | FK → users.id |
| is_system | enum('0','1') | no | 0 | Added 2024_03_28 |
| vendor_id | bigint unsigned | yes | — | Added 2024_03_28 (no FK) |
| created_at / updated_at | timestamp | yes | — | Timestamps |
| deleted_at | timestamp | yes | — | Soft deletes |
Keys / indexes
- created_by / updated_by → users.id ON DELETE CASCADE. `vendor_id` has NO FK.
privacy_policies 9 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| content | longtext | no | — | |
| is_active | enum('0','1') | no | 1 | |
| created_by | bigint unsigned | yes | — | FK → users.id |
| updated_by | bigint unsigned | yes | — | FK → users.id |
| is_system | enum('0','1') | no | 0 | Added 2024_03_28 |
| vendor_id | bigint unsigned | yes | — | Added 2024_03_28 (no FK) |
| created_at / updated_at | timestamp | yes | — | Timestamps |
| deleted_at | timestamp | yes | — | Soft deletes |
Keys / indexes
- created_by / updated_by → users.id ON DELETE CASCADE. `vendor_id` has NO FK.
f_a_q_s 8 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| question | text | no | — | |
| answer | text | no | — | |
| is_active | enum('0','1') | no | 1 | |
| created_by | bigint unsigned | yes | — | FK → users.id |
| updated_by | bigint unsigned | yes | — | FK → users.id |
| created_at / updated_at | timestamp | yes | — | Timestamps |
| deleted_at | timestamp | yes | — | Soft deletes |
Keys / indexes
- created_by / updated_by → users.id ON DELETE CASCADE
contact_messages 10 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| message | text | no | — | |
| name | varchar(255) | no | — | |
varchar(255) | yes | — | ||
| is_read | enum('0','1') | no | 0 | |
| is_active | enum('0','1') | no | 1 | |
| created_by | bigint unsigned | yes | — | FK → users.id |
| updated_by | bigint unsigned | yes | — | FK → users.id |
| created_at / updated_at | timestamp | yes | — | Timestamps |
| deleted_at | timestamp | yes | — | Soft deletes |
Keys / indexes
- created_by / updated_by → users.id ON DELETE CASCADE
Reminders
reminder_channels 7 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| vendor_id | bigint unsigned | no | — | FK → vendors.id |
| email_enabled | boolean (tinyint 1) | no | 1 (true) | |
| sms_enabled | boolean (tinyint 1) | no | 1 (true) | |
| whatsapp_enabled | boolean (tinyint 1) | no | 1 (true) | |
| push_enabled | boolean (tinyint 1) | no | 1 (true) | |
| created_at / updated_at | timestamp | yes | — | Timestamps |
Keys / indexes
- vendor_id → vendors.id (default FK, no explicit onDelete)
reminders 22 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| type | enum('reminder','alert') | no | 'alert' | |
| event_type | enum('new_booking','rescheduled_booking','cancelled_booking','customer_did_not_show_up','completed_booking','new_booking_reminder') | no | — | |
| sort | int | no | — | NOT NULL no default |
| icon | varchar(255) | yes | — | |
| name | varchar(255) | no | — | |
| description | text | no | — | |
| content | longtext | no | — | |
| duration | int | no | 0 | |
| is_active | boolean (tinyint 1) | no | 1 (true) | |
| created_by | bigint unsigned | yes | — | FK → users.id |
| updated_by | bigint unsigned | yes | — | FK → users.id |
| created_at / updated_at | timestamp | yes | — | Timestamps |
| deleted_at | timestamp | yes | — | Soft deletes |
| content_push | longtext | yes | — | Added 2026_06_07 — per-channel template (falls back to content) |
| content_sms | longtext | yes | — | Added 2026_06_07 |
| content_whatsapp | longtext | yes | — | Added 2026_06_07 |
| content_email | longtext | yes | — | Added 2026_06_07 |
| email_enabled | boolean | no | 1 | Added 2026_06_07 — channel flag |
| sms_enabled | boolean | no | 1 | Added 2026_06_07 |
| whatsapp_enabled | boolean | no | 1 | Added 2026_06_07 |
| push_enabled | boolean | no | 1 | Added 2026_06_07 |
Keys / indexes
- created_by → users.id; updated_by → users.id (default FKs)
- UNIQUE `(type, event_type)`
vendor_reminders 18 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK) | no | — | |
| vendor_id | bigint unsigned | no | — | FK → vendors.id |
| reminder_id | bigint unsigned | no | — | FK → reminders.id |
| content | longtext | no | — | |
| duration | int | no | 0 | |
| email_enabled | boolean (tinyint 1) | no | 1 (true) | |
| sms_enabled | boolean (tinyint 1) | no | 1 (true) | |
| whatsapp_enabled | boolean (tinyint 1) | no | 1 (true) | |
| push_enabled | boolean (tinyint 1) | no | 1 (true) | |
| is_active | boolean (tinyint 1) | no | 1 (true) | |
| created_by | bigint unsigned | yes | — | FK → users.id |
| updated_by | bigint unsigned | yes | — | FK → users.id |
| created_at / updated_at | timestamp | yes | — | Timestamps |
| deleted_at | timestamp | yes | — | Soft deletes |
| content_push | longtext | yes | — | Added 2026_06_07 — per-channel template (falls back to content) |
| content_sms | longtext | yes | — | Added 2026_06_07 |
| content_whatsapp | longtext | yes | — | Added 2026_06_07 |
| content_email | longtext | yes | — | Added 2026_06_07 |
Keys / indexes
- vendor_id → vendors.id; reminder_id → reminders.id; created_by → users.id; updated_by → users.id (default FKs)
Queue
jobs 7 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK, auto-inc) | no | — | Primary key |
| queue | varchar(255) | no | — | indexed |
| payload | longtext | no | — | |
| attempts | tinyint unsigned | no | — | |
| reserved_at | int unsigned | yes | — | |
| available_at | int unsigned | no | — | |
| created_at | int unsigned | no | — | (integer, not timestamp) |
Keys / indexes
- INDEX on `queue`
Spatie Permission Tables (teams=false)
permissions 6 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK, auto-inc) | no | — | Primary key |
| name | varchar(255) | no | — | |
| guard_name | varchar(255) | no | — | |
| group | varchar(255) | no | — | |
| model_type | enum('admin','vendor','general') | no | 'admin' | |
| created_at / updated_at | timestamp | yes | — | Timestamps (NO soft deletes) |
Keys / indexes
- UNIQUE `(name, guard_name)` (from create migration)
- UNIQUE `(name, guard_name, model_type)` (added 2024_04_05_003109)
roles 12 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| id | bigint unsigned (PK, auto-inc) | no | — | Primary key |
| name | varchar(255) | no | — | |
| can_edit | tinyint | no | 1 | |
| is_active | enum('0','1') | no | 1 | |
| display_name | varchar(255) | yes | — | (this is on roles, NOT removed) |
| model_type | enum('admin','vendor') | no | 'admin' | |
| model_id | bigint unsigned | yes | — | |
| vendor_id | bigint unsigned | yes | — | FK → vendors.id (added 2025_08_07, after model_id) |
| guard_name | varchar(255) | no | — | |
| created_by | bigint unsigned | yes | — | FK → users.id (added 2025_10_27) |
| updated_by | bigint unsigned | yes | — | FK → users.id (added 2025_10_27) |
| created_at / updated_at | timestamp | yes | — | Timestamps (NO soft deletes) |
Keys / indexes
- vendor_id → vendors.id ON DELETE CASCADE
- created_by → users.id ON DELETE CASCADE; updated_by → users.id ON DELETE CASCADE
- UNIQUE `(name, vendor_id)`
model_has_permissions 3 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| permission_id | bigint unsigned | no | — | FK → permissions.id |
| model_type | varchar(255) | no | — | morph type |
| model_id | bigint unsigned | no | — | morph id |
Keys / indexes
- permission_id → permissions.id ON DELETE CASCADE
- INDEX `model_has_permissions_model_id_model_type_index` on `(model_id, model_type)`
- PRIMARY KEY `(permission_id, model_id, model_type)`
model_has_roles 3 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| role_id | bigint unsigned | no | — | FK → roles.id |
| model_type | varchar(255) | no | — | morph type |
| model_id | bigint unsigned | no | — | morph id |
Keys / indexes
- role_id → roles.id ON DELETE CASCADE
- INDEX `model_has_roles_model_id_model_type_index` on `(model_id, model_type)`
- PRIMARY KEY `(role_id, model_id, model_type)`
role_has_permissions 2 cols
| Column | Type | Null | Default | Notes |
|---|---|---|---|---|
| permission_id | bigint unsigned | no | — | FK → permissions.id |
| role_id | bigint unsigned | no | — | FK → roles.id |
Keys / indexes
- permission_id → permissions.id ON DELETE CASCADE
- role_id → roles.id ON DELETE CASCADE
- PRIMARY KEY `(permission_id, role_id)`