Files
ladill-pos/app/Support/helpers.php
T
isaaccladandCursor e5d2b84388
Deploy Ladill Mini / deploy (push) Successful in 23s
Add Ladill POS v1 — register, Pay checkout, and commerce links.
Staff-facing counter register at pos.ladill.com with catalog cart, cash and
MoMo/card checkout via Ladill Pay, CRM timeline/import, invoice prefill, and
Merchant catalog import.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-23 22:52:24 +00:00

41 lines
1.1 KiB
PHP

<?php
use App\Models\User;
if (! function_exists('ladill_account')) {
/**
* The account the current request acts within — the owner User. Defaults to
* the authenticated user; a team member who switched accounts gets the owner.
* Set by the SetActingAccount middleware.
*/
function ladill_account(): ?User
{
$request = request();
return $request->attributes->get('actingAccount') ?? $request->user();
}
}
if (! function_exists('ladill_domains_url')) {
function ladill_domains_url(string $path = ''): string
{
return 'https://'.config('app.domains_domain').($path !== '' ? '/'.ltrim($path, '/') : '');
}
}
if (! function_exists('ladill_account_url')) {
function ladill_account_url(string $path = ''): string
{
return 'https://'.config('app.account_domain').($path !== '' ? '/'.ltrim($path, '/') : '');
}
}
if (! function_exists('pos_money')) {
function pos_money(?int $minor, ?string $currency = null): string
{
$currency = $currency ?: config('pos.default_currency', 'GHS');
return $currency.' '.number_format(((int) $minor) / 100, 2);
}
}