Files
ladill-woo-manager/app/Http/Controllers/Woo/IntegrationController.php
T
isaaccladandCursor 644c3d9cde
Deploy Ladill Woo Manager / deploy (push) Successful in 1m5s
Add catalog sync trigger, metrics, and shipping label actions to integrations.
Surfaces actionable controls in Ladill instead of status-only cards: sync catalogs via the plugin proxy, show channel metrics, and link to orders/labels for fulfillment.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-08 11:28:42 +00:00

55 lines
1.7 KiB
PHP

<?php
namespace App\Http\Controllers\Woo;
use App\Http\Controllers\Controller;
use App\Http\Controllers\Woo\Concerns\ResolvesWooContext;
use App\Services\Woo\IntegrationStatusService;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\View\View;
class IntegrationController extends Controller
{
use ResolvesWooContext;
public function __construct(private IntegrationStatusService $integrations) {}
public function index(Request $request): View
{
$store = $this->currentStore($request);
$payload = $this->integrations->forStore($store);
return view('woo.integrations.index', [
'store' => $store,
'reachable' => $payload['reachable'],
'cached' => (bool) ($payload['cached'] ?? false),
'integrations' => $payload['integrations'],
]);
}
public function refresh(Request $request): RedirectResponse
{
$store = $this->currentStore($request);
if ($store) {
$this->integrations->forStore($store, refresh: true);
}
return redirect()
->route('woo.integrations.index')
->with('success', $store
? 'Integration status refreshed.'
: 'Connect a store to refresh integration status.');
}
public function sync(Request $request, string $integration): RedirectResponse
{
$store = $this->currentStore($request);
$result = $this->integrations->syncCatalog($store, $integration);
return redirect()
->route('woo.integrations.index')
->with($result['success'] ? 'success' : 'error', $result['message']);
}
}