Files
ladill-merchant/routes/web.php
T
isaacclad c11cc99d17
Deploy Ladill Merchant / deploy (push) Successful in 1m5s
Present Paystack checkout in a responsive mobile sheet and desktop modal.
Standardize customer-facing Ladill Pay checkout shells across products, open them on all viewports, and escape iframe callbacks back to the product flow.
2026-07-21 16:50:07 +00:00

102 lines
7.7 KiB
PHP

<?php
use App\Http\Controllers\Auth\SsoLoginController;
use App\Http\Controllers\WalletBalanceController;
use App\Http\Controllers\Merchant\OrdersController;
use App\Http\Controllers\Merchant\OverviewController;
use App\Http\Controllers\Merchant\PayoutsController;
use App\Http\Controllers\Merchant\ProductController;
use App\Http\Controllers\Merchant\CustomDomainController;
use App\Http\Controllers\Merchant\StorefrontController;
use App\Http\Controllers\NotificationController;
use App\Http\Controllers\Public\BookingController;
use App\Http\Controllers\Public\QrScanController;
use App\Http\Controllers\Public\SaleOrderController;
use App\Http\Controllers\Qr\AccountController;
use App\Http\Controllers\Qr\AfiaController;
use App\Http\Controllers\Qr\TeamController;
use App\Http\Controllers\SearchController;
use Illuminate\Support\Facades\Route;
Route::get('/', function (\Illuminate\Http\Request $request) {
// A customer's connected custom domain serves its mapped storefront here.
$storefront = app(\App\Services\CustomDomain\CustomDomainService::class)->resolveStorefront($request->getHost());
if ($storefront) {
return app(QrScanController::class)->resolve($request, $storefront->short_code);
}
return auth()->check()
? redirect()->route('merchant.dashboard')
: redirect()->route('sso.connect');
})->name('merchant.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('merchant.dashboard') : view('merchant.signed-out'))->name('merchant.signed-out');
Route::middleware('redirect.legacy.qr')->group(function () {
Route::get('/q/{shortCode}', [QrScanController::class, 'resolve'])->name('qr.public.resolve');
Route::get('/q/{shortCode}/view', [QrScanController::class, 'view'])->name('qr.public.view');
Route::get('/q/{shortCode}/file', [QrScanController::class, 'file'])->name('qr.public.file');
Route::get('/q/{shortCode}/item-image/{section}/{item}', [QrScanController::class, 'itemImage'])->name('qr.public.item-image')->whereNumber(['section', 'item']);
Route::get('/q/{shortCode}/cover', [QrScanController::class, 'bookCover'])->name('qr.public.booking.cover');
Route::get('/q/{shortCode}/menu-logo', [QrScanController::class, 'menuLogo'])->name('qr.public.menu.logo');
Route::get('/q/{shortCode}/menu-cover', [QrScanController::class, 'menuCover'])->name('qr.public.menu.cover');
Route::get('/q/{shortCode}/booking/slots', [BookingController::class, 'slots'])->name('qr.public.booking.slots');
Route::post('/q/{shortCode}/booking', [BookingController::class, 'store'])->name('qr.public.booking.store');
Route::get('/q/{shortCode}/booking/callback', [BookingController::class, 'callback'])->name('qr.public.booking.callback');
Route::get('/q/{shortCode}/booking/confirmed/{booking}', [BookingController::class, 'confirmed'])->name('qr.public.booking.confirmed');
Route::post('/q/{shortCode}/order', [SaleOrderController::class, 'store'])->name('qr.public.order');
Route::get('/q/{shortCode}/order/callback', [SaleOrderController::class, 'callback'])->name('qr.public.order.callback');
Route::get('/q/{shortCode}/order/confirmed/{reference}', [SaleOrderController::class, 'confirmed'])->name('qr.public.order.confirmed');
});
Route::middleware(['auth', 'platform.session'])->group(function () {
Route::get('/wallet/balance', [WalletBalanceController::class, 'balance'])->name('wallet.balance');
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', [OverviewController::class, 'index'])->name('merchant.dashboard');
Route::get('/search', SearchController::class)->name('merchant.search');
Route::post('/afia/chat', [AfiaController::class, 'chat'])->name('merchant.afia.chat');
Route::get('/storefronts', [StorefrontController::class, 'index'])->name('merchant.storefronts.index');
Route::get('/storefronts/create', [StorefrontController::class, 'create'])->name('merchant.storefronts.create');
Route::post('/storefronts', [StorefrontController::class, 'store'])->name('merchant.storefronts.store');
Route::get('/storefronts/{storefront}', [StorefrontController::class, 'show'])->name('merchant.storefronts.show');
Route::patch('/storefronts/{storefront}', [StorefrontController::class, 'update'])->name('merchant.storefronts.update');
Route::delete('/storefronts/{storefront}', [StorefrontController::class, 'destroy'])->name('merchant.storefronts.destroy');
Route::get('/storefronts/{storefront}/preview.png', [StorefrontController::class, 'preview'])->name('merchant.storefronts.preview');
Route::get('/storefronts/{storefront}/download/{format}', [StorefrontController::class, 'download'])->name('merchant.storefronts.download')->whereIn('format', ['png', 'svg', 'pdf']);
// Custom domains (opt-in): connect a customer's own domain to a storefront.
Route::post('/storefronts/{storefront}/custom-domain', [CustomDomainController::class, 'store'])->name('merchant.custom-domain.store');
Route::post('/custom-domains/{customDomain}/verify', [CustomDomainController::class, 'verify'])->name('merchant.custom-domain.verify');
Route::delete('/custom-domains/{customDomain}', [CustomDomainController::class, 'destroy'])->name('merchant.custom-domain.destroy');
Route::get('/products', [ProductController::class, 'index'])->name('merchant.products.index');
Route::get('/products/create', [ProductController::class, 'create'])->name('merchant.products.create');
Route::post('/products', [ProductController::class, 'store'])->name('merchant.products.store');
Route::get('/products/{product}/edit', [ProductController::class, 'edit'])->name('merchant.products.edit');
Route::put('/products/{product}', [ProductController::class, 'update'])->name('merchant.products.update');
Route::delete('/products/{product}', [ProductController::class, 'destroy'])->name('merchant.products.destroy');
Route::get('/orders', [OrdersController::class, 'index'])->name('merchant.orders.index');
Route::patch('/orders/{order}/status', [OrdersController::class, 'updateStatus'])->name('merchant.orders.update-status');
Route::patch('/bookings/{booking}/status', [OrdersController::class, 'updateBookingStatus'])->name('merchant.bookings.update-status');
Route::get('/payouts', [PayoutsController::class, 'index'])->name('merchant.payouts');
Route::get('/settings', [AccountController::class, 'settings'])->name('account.settings');
Route::put('/settings', [AccountController::class, 'updateSettings'])->name('account.settings.update');
Route::get('/team', fn () => redirect()->away(ladill_account_url('/account/team')))->name('account.team');
Route::post('/switch-account', [TeamController::class, 'switchAccount'])->name('account.switch');
});