Aggregate ladl.link slugs from all platform apps in the link list.
Deploy Ladill Link / deploy (push) Successful in 29s
Deploy Ladill Link / deploy (push) Successful in 29s
Sync QR and storefront short codes from sibling apps via a platform catalog API so My Links shows every ladl.link URL in one place. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -5,6 +5,7 @@ namespace App\Http\Controllers\Link;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\ShortLink;
|
||||
use App\Services\Link\LinkBillingService;
|
||||
use App\Services\Link\LinkCatalogSyncService;
|
||||
use App\Services\Link\LinkManagerService;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -16,11 +17,14 @@ class LinkController extends Controller
|
||||
public function __construct(
|
||||
private LinkManagerService $links,
|
||||
private LinkBillingService $billing,
|
||||
private LinkCatalogSyncService $catalogSync,
|
||||
) {}
|
||||
|
||||
public function index(Request $request): View
|
||||
{
|
||||
$account = ladill_account();
|
||||
$this->catalogSync->syncForUser($account);
|
||||
|
||||
$links = ShortLink::query()
|
||||
->where('user_id', $account->id)
|
||||
->latest()
|
||||
@@ -77,6 +81,10 @@ class LinkController extends Controller
|
||||
{
|
||||
$this->authorizeLink($link);
|
||||
|
||||
if (! $link->is_managed_here) {
|
||||
return back()->withErrors(['link' => 'This link is managed in '.$link->sourceAppLabel().'.']);
|
||||
}
|
||||
|
||||
$validated = $request->validate([
|
||||
'destination_url' => ['sometimes', 'required', 'string', 'max:2048'],
|
||||
'label' => ['nullable', 'string', 'max:120'],
|
||||
@@ -96,6 +104,11 @@ class LinkController extends Controller
|
||||
public function destroy(ShortLink $link): RedirectResponse
|
||||
{
|
||||
$this->authorizeLink($link);
|
||||
|
||||
if (! $link->is_managed_here) {
|
||||
return back()->withErrors(['link' => 'This link is managed in '.$link->sourceAppLabel().'.']);
|
||||
}
|
||||
|
||||
$link->delete();
|
||||
|
||||
return redirect()->route('user.links.index')->with('success', 'Link deleted.');
|
||||
|
||||
@@ -4,13 +4,19 @@ namespace App\Http\Controllers\Link;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\ShortLink;
|
||||
use App\Services\Link\LinkCatalogSyncService;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class OverviewController extends Controller
|
||||
{
|
||||
public function __construct(
|
||||
private LinkCatalogSyncService $catalogSync,
|
||||
) {}
|
||||
|
||||
public function index(): View
|
||||
{
|
||||
$account = ladill_account();
|
||||
$this->catalogSync->syncForUser($account);
|
||||
$wallet = $account->getOrCreateLinkWallet();
|
||||
|
||||
$recentLinks = ShortLink::query()
|
||||
|
||||
Reference in New Issue
Block a user