Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Henry4ndrew/saborGestion/llms.txt

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

SaborGestion uses a MySQL database named saborGestion. The schema is managed entirely through Laravel migrations. The tables below are documented in migration order, reflecting their foreign-key dependency chain.
Column definitions are extracted directly from the migration files in database/migrations/. Do not edit the schema by hand in MySQL — always create a new migration.

Table overview

TablePurposeKey relationships
usersApplication users with roles
sessionsLaravel session storageuser_id → users.id (nullable)
password_reset_tokensPassword reset tokens
productosMenu items for sale
inventariosIngredient stock levels
mesasPhysical restaurant tables
pedidosCustomer ordersmesa_id → mesas.id
comandasIndividual line items within an orderpedido_id → pedidos.id, producto_id → productos.id
deliveriesDelivery details for an orderpedido_id → pedidos.id
facturasInvoices generated from orderspedido_id → pedidos.id
pagosPayments applied to an invoicefactura_id → facturas.id
cierre_cajasEnd-of-day cash register summaries

users

Created by 0001_01_01_000000_create_users_table.php and extended by 2026_03_20_235344_add_role_to_users_table.php.
ColumnTypeNullableDefaultNotes
idbigint unsignedNoautoPrimary key
namevarcharNo
emailvarcharNoUnique
email_verified_attimestampYesNULL
passwordvarcharNoBcrypt hashed
roleenumNomeseroadmin, mesero, cocinero, cajero
remember_tokenvarchar(100)YesNULL
created_attimestampYesNULL
updated_attimestampYesNULL
// Migration: add_role_to_users_table
Schema::table('users', function (Blueprint $table) {
    $table->enum('role', ['admin', 'mesero', 'cocinero', 'cajero'])->default('mesero');
});

password_reset_tokens

ColumnTypeNullableNotes
emailvarcharNoPrimary key
tokenvarcharNo
created_attimestampYes

sessions

ColumnTypeNullableNotes
idvarcharNoPrimary key
user_idbigint unsignedYesIndexed; references users.id
ip_addressvarchar(45)YesSupports IPv6
user_agenttextYes
payloadlongtextNo
last_activityintegerNoIndexed

productos

Migration: 2026_03_21_004400_create_productos_table.php
ColumnTypeNullableDefaultNotes
idbigint unsignedNoautoPrimary key
nombrevarcharNoProduct name
descripciontextYesNULL
preciodecimal(10,2)No
categoriavarcharNo
activotinyint(1)No1Boolean; cast to bool in model
created_attimestampYesNULL
updated_attimestampYesNULL
Schema::create('productos', function (Blueprint $table) {
    $table->id();
    $table->string('nombre');
    $table->text('descripcion')->nullable();
    $table->decimal('precio', 10, 2);
    $table->string('categoria');
    $table->boolean('activo')->default(true);
    $table->timestamps();
});

inventarios

Migration: 2026_03_21_004623_create_inventarios_table.php
ColumnTypeNullableDefaultNotes
idbigint unsignedNoautoPrimary key
ingredientevarcharNoIngredient name
cantidaddecimal(10,2)NoCurrent stock level
unidadvarcharNoUnit of measure (e.g., kg, litros)
stock_minimodecimal(10,2)No5.00Alert threshold
created_attimestampYesNULL
updated_attimestampYesNULL
Schema::create('inventarios', function (Blueprint $table) {
    $table->id();
    $table->string('ingrediente');
    $table->decimal('cantidad', 10, 2);
    $table->string('unidad');
    $table->decimal('stock_minimo', 10, 2)->default(5);
    $table->timestamps();
});
The sidebar displays a notification badge when cantidad falls below stock_minimo. Query Inventario::where('cantidad', '<', DB::raw('stock_minimo'))->count() to get the count.

mesas

Migration: 2026_03_21_004811_create_mesas_table.php
ColumnTypeNullableDefaultNotes
idbigint unsignedNoautoPrimary key
numerovarcharNoTable identifier (e.g., "5", "A3")
capacidadintegerNoNumber of seats
estadoenumNodisponibledisponible, ocupada, reservada
created_attimestampYesNULL
updated_attimestampYesNULL
Schema::create('mesas', function (Blueprint $table) {
    $table->id();
    $table->string('numero');
    $table->integer('capacidad');
    $table->enum('estado', ['disponible', 'ocupada', 'reservada'])->default('disponible');
    $table->timestamps();
});

pedidos

Migration: 2026_03_21_012542_create_pedidos_table.php
ColumnTypeNullableDefaultNotes
idbigint unsignedNoautoPrimary key
mesa_idbigint unsignedYesNULLFK → mesas.id ON DELETE SET NULL
clientevarcharYesNULLCustomer name (used for delivery orders)
totaldecimal(10,2)No0.00
estadoenumNopendientependiente, preparando, listo, entregado, cancelado
fechatimestampNoCURRENT_TIMESTAMPOrder creation timestamp
created_attimestampYesNULL
updated_attimestampYesNULL
Schema::create('pedidos', function (Blueprint $table) {
    $table->id();
    $table->foreignId('mesa_id')->nullable()->constrained()->onDelete('set null');
    $table->string('cliente')->nullable();
    $table->decimal('total', 10, 2)->default(0);
    $table->enum('estado', ['pendiente', 'preparando', 'listo', 'entregado', 'cancelado'])->default('pendiente');
    $table->timestamp('fecha')->useCurrent();
    $table->timestamps();
});
mesa_id is nullable so that delivery orders — which have no physical table — can still be recorded as pedidos.

comandas

Migration: 2026_03_21_012543_create_comandas_table.php
ColumnTypeNullableDefaultNotes
idbigint unsignedNoautoPrimary key
pedido_idbigint unsignedNoFK → pedidos.id ON DELETE CASCADE
producto_idbigint unsignedNoFK → productos.id ON DELETE CASCADE
cantidadintegerNo
estadoenumNopendientependiente, preparando, listo
created_attimestampYesNULL
updated_attimestampYesNULL
Schema::create('comandas', function (Blueprint $table) {
    $table->id();
    $table->foreignId('pedido_id')->constrained()->onDelete('cascade');
    $table->foreignId('producto_id')->constrained()->onDelete('cascade');
    $table->integer('cantidad');
    $table->enum('estado', ['pendiente', 'preparando', 'listo'])->default('pendiente');
    $table->timestamps();
});

deliveries

Migration: 2026_03_21_012544_create_deliveries_table.php
ColumnTypeNullableDefaultNotes
idbigint unsignedNoautoPrimary key
pedido_idbigint unsignedNoFK → pedidos.id ON DELETE CASCADE
direccionvarcharNoDelivery address
telefonovarcharNoCustomer phone number
repartidorvarcharYesNULLAssigned delivery person
estadoenumNopendientependiente, en_camino, entregado
created_attimestampYesNULL
updated_attimestampYesNULL
Schema::create('deliveries', function (Blueprint $table) {
    $table->id();
    $table->foreignId('pedido_id')->constrained()->onDelete('cascade');
    $table->string('direccion');
    $table->string('telefono');
    $table->string('repartidor')->nullable();
    $table->enum('estado', ['pendiente', 'en_camino', 'entregado'])->default('pendiente');
    $table->timestamps();
});

facturas

Migration: 2026_03_21_012544_create_facturas_table.php
ColumnTypeNullableDefaultNotes
idbigint unsignedNoautoPrimary key
pedido_idbigint unsignedNoFK → pedidos.id ON DELETE CASCADE
totaldecimal(10,2)No
fechatimestampNoCURRENT_TIMESTAMP
estadoenumNoprefacturaprefactura, facturado
created_attimestampYesNULL
updated_attimestampYesNULL
Schema::create('facturas', function (Blueprint $table) {
    $table->id();
    $table->foreignId('pedido_id')->constrained()->onDelete('cascade');
    $table->decimal('total', 10, 2);
    $table->timestamp('fecha')->useCurrent();
    $table->enum('estado', ['prefactura', 'facturado'])->default('prefactura');
    $table->timestamps();
});

pagos

Migration: 2026_03_21_012545_create_pagos_table.php
ColumnTypeNullableDefaultNotes
idbigint unsignedNoautoPrimary key
factura_idbigint unsignedNoFK → facturas.id ON DELETE CASCADE
montodecimal(10,2)NoPayment amount
metodoenumNoefectivo, tarjeta, transferencia, otro
fechatimestampNoCURRENT_TIMESTAMP
created_attimestampYesNULL
updated_attimestampYesNULL
Schema::create('pagos', function (Blueprint $table) {
    $table->id();
    $table->foreignId('factura_id')->constrained()->onDelete('cascade');
    $table->decimal('monto', 10, 2);
    $table->enum('metodo', ['efectivo', 'tarjeta', 'transferencia', 'otro']);
    $table->timestamp('fecha')->useCurrent();
    $table->timestamps();
});

cierre_cajas

Migration: 2026_03_21_012546_create_cierre_cajas_table.php
ColumnTypeNullableDefaultNotes
idbigint unsignedNoautoPrimary key
fechatimestampNoCURRENT_TIMESTAMPClose timestamp
total_ventasdecimal(10,2)No0.00Sum of all payments
total_efectivodecimal(10,2)No0.00Cash payments subtotal
total_tarjetadecimal(10,2)No0.00Card payments subtotal
total_otrosdecimal(10,2)No0.00Transfer / other subtotal
observacionestextYesNULLFree-text notes
created_attimestampYesNULL
updated_attimestampYesNULL
Schema::create('cierre_cajas', function (Blueprint $table) {
    $table->id();
    $table->timestamp('fecha')->useCurrent();
    $table->decimal('total_ventas', 10, 2)->default(0);
    $table->decimal('total_efectivo', 10, 2)->default(0);
    $table->decimal('total_tarjeta', 10, 2)->default(0);
    $table->decimal('total_otros', 10, 2)->default(0);
    $table->text('observaciones')->nullable();
    $table->timestamps();
});

Foreign key summary

Child tableForeign key columnReferencesOn delete
sessionsuser_idusers.id(no constraint — nullable index)
pedidosmesa_idmesas.idSET NULL
comandaspedido_idpedidos.idCASCADE
comandasproducto_idproductos.idCASCADE
deliveriespedido_idpedidos.idCASCADE
facturaspedido_idpedidos.idCASCADE
pagosfactura_idfacturas.idCASCADE
pedidos.mesa_id uses SET NULL on delete, so deleting a mesa does not delete its associated pedidos — it only nullifies the reference. Ensure your business logic accounts for pedidos with a null mesa_id.

Running migrations

# Run all pending migrations
php artisan migrate

# Roll back the last batch
php artisan migrate:rollback

# Fresh install (drops all tables, re-runs all migrations)
php artisan migrate:fresh

Build docs developers (and LLMs) love