From de2eab7ef8e80be2ceb7b35c910f4ee5e2e885e2 Mon Sep 17 00:00:00 2001 From: isaacclad Date: Sat, 27 Jun 2026 15:28:50 +0000 Subject: [PATCH] Add LadillLink helper for ladl.link public QR paths. Storefront and landing views use publicPath() so menu, shop, and booking pages resolve asset URLs on ladl.link. Co-authored-by: Cursor --- app/Models/QrCode.php | 23 ++++++++++------------- app/Support/LadillLink.php | 26 ++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 13 deletions(-) create mode 100644 app/Support/LadillLink.php diff --git a/app/Models/QrCode.php b/app/Models/QrCode.php index 4afad66..3a2c767 100644 --- a/app/Models/QrCode.php +++ b/app/Models/QrCode.php @@ -2,6 +2,7 @@ namespace App\Models; +use App\Support\LadillLink; use App\Support\Qr\QrStyleDefaults; use App\Support\Qr\QrTypeCatalog; use App\Support\Qr\QrWifiPayload; @@ -82,23 +83,19 @@ class QrCode extends Model public function publicUrl(): string { - return self::publicBaseUrl() . '/q/' . $this->short_code; + return LadillLink::url($this->short_code); + } + + public function publicPath(string $suffix = ''): string + { + return $suffix === '' + ? $this->publicUrl() + : LadillLink::path($this->short_code, $suffix); } - /** - * Base URL for public QR links. Always the short platform domain - * (ladill.com) — never the signed-in account/product host — so printed - * codes and shared links stay short and host-independent of where the QR - * was created. - */ public static function publicBaseUrl(): string { - $appUrl = (string) config('app.url'); - $scheme = parse_url($appUrl, PHP_URL_SCHEME) ?: 'https'; - $host = (string) config('app.platform_domain') - ?: (parse_url($appUrl, PHP_URL_HOST) ?: 'ladill.com'); - - return $scheme . '://' . $host; + return LadillLink::baseUrl(); } /** diff --git a/app/Support/LadillLink.php b/app/Support/LadillLink.php new file mode 100644 index 0000000..3a51bc0 --- /dev/null +++ b/app/Support/LadillLink.php @@ -0,0 +1,26 @@ +