Add Ladill Link URL shortener on ladl.link.
Management UI at link.ladill.com with GHS 0.05 per link wallet billing, click analytics, and legacy fallback to ladill.com/q for QR ecosystem codes. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Public;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Link\LinkManagerService;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class LinkRedirectController extends Controller
|
||||
{
|
||||
public function __construct(
|
||||
private LinkManagerService $links,
|
||||
) {}
|
||||
|
||||
public function resolve(Request $request, string $slug): RedirectResponse|View
|
||||
{
|
||||
$link = $this->links->resolve($request, $slug);
|
||||
|
||||
if ($link !== null) {
|
||||
return redirect()->away($link->destination_url, 302);
|
||||
}
|
||||
|
||||
// Legacy QR / storefront codes still resolve on ladill.com/q/*
|
||||
$legacy = rtrim((string) config('app.platform_url', 'https://ladill.com'), '/').'/q/'.$slug;
|
||||
$qs = $request->getQueryString();
|
||||
|
||||
return redirect()->away($legacy.($qs ? '?'.$qs : ''), 302);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user