Deploy Ladill POS / deploy (push) Successful in 23s
The "links" slice — a guest scans a table's QR, browses the menu (with
modifiers), and submits an order that lands on that table's open tab and fires
straight to the Kitchen Display.
- Public, auth-free flow scoped by an unguessable table short_code:
GET /t/{code} (menu + client cart), POST /t/{code}/order (throttled),
GET /t/{code}/done. Orders open/append the table's dine-in tab, add lines as
source=guest, and send to the kitchen.
- Staff print a per-table QR (Settings → table → QR; renders client-side to the
public menu URL). short_code is generated lazily.
- Guest lines are badged on the ticket and the KDS so staff can tell them apart;
staff still settle the tab as usual (cash / Ladill Pay).
- Extracted PosSaleService::buildProductLine as the single product+modifier
price resolver, now shared by staff and guest ordering (client prices never
trusted).
Schema additive: pos_tables.short_code, pos_sale_lines.source. New
PosRestaurantTest covers the guest order firing to the kitchen; suite green (12).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
99 lines
7.1 KiB
PHP
99 lines
7.1 KiB
PHP
<?php
|
|
|
|
use App\Http\Controllers\Auth\SsoLoginController;
|
|
use App\Http\Controllers\Pos\AiController;
|
|
use App\Http\Controllers\Pos\DashboardController;
|
|
use App\Http\Controllers\Pos\KitchenController;
|
|
use App\Http\Controllers\Pos\MenuController;
|
|
use App\Http\Controllers\Pos\ProductController;
|
|
use App\Http\Controllers\Pos\RegisterController;
|
|
use App\Http\Controllers\Pos\SaleController;
|
|
use App\Http\Controllers\Pos\SettingsController;
|
|
use App\Http\Controllers\Pos\TableController;
|
|
use App\Http\Controllers\Pos\TicketController;
|
|
use App\Http\Controllers\NotificationController;
|
|
use App\Http\Controllers\Public\TableOrderController;
|
|
use App\Http\Controllers\WalletBalanceController;
|
|
use Illuminate\Support\Facades\Route;
|
|
|
|
Route::get('/', fn () => auth()->check()
|
|
? redirect()->route('pos.dashboard')
|
|
: redirect()->route('sso.connect'))->name('pos.root');
|
|
|
|
Route::get('/login', [SsoLoginController::class, 'connect'])->name('login');
|
|
Route::get('/sso/connect', [SsoLoginController::class, 'connect'])->name('sso.connect');
|
|
Route::get('/sso/callback', [SsoLoginController::class, 'callback'])->name('sso.callback');
|
|
Route::post('/logout', [SsoLoginController::class, 'logout'])->name('logout');
|
|
Route::get('/sso/logout-bridge', [SsoLoginController::class, 'logoutBridge'])->name('sso.logout-bridge');
|
|
Route::get('/sso/logout-frontchannel', [SsoLoginController::class, 'frontchannelLogout'])->name('sso.logout-frontchannel');
|
|
Route::get('/sso/platform-signed-out', [SsoLoginController::class, 'platformSignedOut'])->name('sso.platform-signed-out');
|
|
Route::get('/signed-out', fn () => auth()->check() ? redirect()->route('pos.dashboard') : view('auth.signed-out'))->name('pos.signed-out');
|
|
|
|
Route::get('/sales/{sale}/callback', [SaleController::class, 'callback'])->name('pos.sales.callback');
|
|
|
|
// Public table-QR ordering (no auth — scoped by the table short_code).
|
|
Route::get('/t/{code}', [TableOrderController::class, 'menu'])->name('pos.table.menu');
|
|
Route::post('/t/{code}/order', [TableOrderController::class, 'store'])->middleware('throttle:20,1')->name('pos.table.order');
|
|
Route::get('/t/{code}/done', [TableOrderController::class, 'confirmed'])->name('pos.table.confirmed');
|
|
|
|
Route::middleware(['auth', 'platform.session'])->group(function () {
|
|
Route::get('/wallet/balance', [WalletBalanceController::class, 'balance'])->name('wallet.balance');
|
|
|
|
Route::post('/ai/chat', [AiController::class, 'chat'])->middleware('throttle:30,1')->name('pos.ai.chat');
|
|
|
|
Route::get('/notifications', [NotificationController::class, 'index'])->name('notifications.index');
|
|
Route::get('/notifications/unread', [NotificationController::class, 'unread'])->name('notifications.unread');
|
|
Route::post('/notifications/{id}/read', [NotificationController::class, 'markAsRead'])->name('notifications.mark-read');
|
|
Route::post('/notifications/mark-all-read', [NotificationController::class, 'markAllAsRead'])->name('notifications.mark-all-read');
|
|
|
|
Route::get('/dashboard', [DashboardController::class, 'index'])->name('pos.dashboard');
|
|
|
|
Route::get('/register', [RegisterController::class, 'index'])->name('pos.register');
|
|
Route::post('/register/charge', [RegisterController::class, 'charge'])->name('pos.register.charge');
|
|
|
|
Route::get('/sales', [SaleController::class, 'index'])->name('pos.sales.index');
|
|
Route::get('/sales/{sale}', [SaleController::class, 'show'])->name('pos.sales.show');
|
|
|
|
// Restaurant mode — floor, open tickets (tabs), and the kitchen display.
|
|
Route::get('/floor', [TableController::class, 'index'])->name('pos.floor');
|
|
Route::get('/floor/tables/{table}/qr', [TableController::class, 'qr'])->name('pos.tables.qr');
|
|
Route::post('/tickets', [TicketController::class, 'open'])->name('pos.tickets.open');
|
|
Route::get('/tickets/{sale}', [TicketController::class, 'show'])->name('pos.tickets.show');
|
|
Route::post('/tickets/{sale}/lines', [TicketController::class, 'addLine'])->name('pos.tickets.lines.add');
|
|
Route::patch('/tickets/{sale}/lines/{line}', [TicketController::class, 'updateLine'])->name('pos.tickets.lines.update');
|
|
Route::delete('/tickets/{sale}/lines/{line}', [TicketController::class, 'removeLine'])->name('pos.tickets.lines.remove');
|
|
Route::post('/tickets/{sale}/send', [TicketController::class, 'sendToKitchen'])->name('pos.tickets.send');
|
|
Route::post('/tickets/{sale}/settle', [TicketController::class, 'settle'])->name('pos.tickets.settle');
|
|
|
|
Route::get('/kitchen', [KitchenController::class, 'index'])->name('pos.kitchen');
|
|
Route::get('/kitchen/feed', [KitchenController::class, 'feed'])->name('pos.kitchen.feed');
|
|
Route::post('/kitchen/lines/{line}/bump', [KitchenController::class, 'bump'])->name('pos.kitchen.bump');
|
|
|
|
// Menu depth — categories, kitchen stations, and modifier groups/options.
|
|
Route::get('/menu', [MenuController::class, 'index'])->name('pos.menu');
|
|
Route::post('/menu/categories', [MenuController::class, 'storeCategory'])->name('pos.menu.categories.store');
|
|
Route::delete('/menu/categories/{category}', [MenuController::class, 'destroyCategory'])->name('pos.menu.categories.destroy');
|
|
Route::post('/menu/stations', [MenuController::class, 'storeStation'])->name('pos.menu.stations.store');
|
|
Route::delete('/menu/stations/{station}', [MenuController::class, 'destroyStation'])->name('pos.menu.stations.destroy');
|
|
Route::post('/menu/groups', [MenuController::class, 'storeGroup'])->name('pos.menu.groups.store');
|
|
Route::delete('/menu/groups/{group}', [MenuController::class, 'destroyGroup'])->name('pos.menu.groups.destroy');
|
|
Route::post('/menu/groups/{group}/modifiers', [MenuController::class, 'storeModifier'])->name('pos.menu.modifiers.store');
|
|
Route::delete('/menu/modifiers/{modifier}', [MenuController::class, 'destroyModifier'])->name('pos.menu.modifiers.destroy');
|
|
|
|
Route::get('/products', [ProductController::class, 'index'])->name('pos.products.index');
|
|
Route::get('/products/create', [ProductController::class, 'create'])->name('pos.products.create');
|
|
Route::post('/products', [ProductController::class, 'store'])->name('pos.products.store');
|
|
Route::get('/products/{product}/edit', [ProductController::class, 'edit'])->name('pos.products.edit');
|
|
Route::put('/products/{product}', [ProductController::class, 'update'])->name('pos.products.update');
|
|
Route::delete('/products/{product}', [ProductController::class, 'destroy'])->name('pos.products.destroy');
|
|
|
|
Route::get('/settings', [SettingsController::class, 'index'])->name('pos.settings');
|
|
Route::put('/settings', [SettingsController::class, 'update'])->name('pos.settings.update');
|
|
Route::post('/settings/import-crm', [SettingsController::class, 'importCrm'])->name('pos.settings.import-crm');
|
|
Route::post('/settings/import-merchant', [SettingsController::class, 'importMerchant'])->name('pos.settings.import-merchant');
|
|
Route::post('/settings/tables', [SettingsController::class, 'storeTable'])->name('pos.settings.tables.store');
|
|
Route::delete('/settings/tables/{table}', [SettingsController::class, 'destroyTable'])->name('pos.settings.tables.destroy');
|
|
|
|
Route::get('/wallet', fn () => redirect()->away(ladill_account_url('/wallet')))->name('pos.wallet');
|
|
});
|