16235369cb
Highlights include configurable menus, specials, cart/checkout, taxes, customer accounts with email 2FA, newsletters, analytics, refunds, PDF/CSV exports, Square/Mailgun adapters, and optional MySQL migration. See README.md for setup and production configuration. Verified PHP/JavaScript syntax, responsive layouts, registration, 2FA, checkout, dashboard workflows, settings persistence, and PDF generation. Real Square, Mailgun, and MySQL connections require credentials/server access. Square implementation follows the official Payments API and Refunds API.
37 lines
856 B
PHP
37 lines
856 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace FatBottom\Controllers;
|
|
|
|
use FatBottom\Core\Auth;
|
|
use FatBottom\Core\Config;
|
|
use FatBottom\Core\Http;
|
|
use FatBottom\Services\CartService;
|
|
|
|
abstract class BaseController
|
|
{
|
|
public function __construct(
|
|
protected readonly Config $config,
|
|
protected readonly Auth $auth,
|
|
protected readonly CartService $cart
|
|
) {
|
|
}
|
|
|
|
protected function shared(array $data = []): array
|
|
{
|
|
$user = $this->auth->user();
|
|
$cart = $this->cart->details($user ? (int) $user['id'] : null);
|
|
|
|
return array_merge([
|
|
'config' => $this->config,
|
|
'auth' => $this->auth,
|
|
'currentUser' => $user,
|
|
'currentCart' => $cart,
|
|
'flashMessages' => Http::consumeFlash(),
|
|
'old' => Http::consumeOld(),
|
|
], $data);
|
|
}
|
|
}
|
|
|