Sync Care queue integration flag with Ladill Queue on enable.
Deploy Ladill Care / deploy (push) Successful in 42s

Provision alone left care_enabled false on Queue; settings re-save and
service queue pages now recover when integration is out of sync.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-07-05 22:06:03 +00:00
co-authored by Cursor
parent eba408197c
commit 527244948c
3 changed files with 25 additions and 4 deletions
@@ -29,7 +29,16 @@ class ServiceQueueController extends Controller
try {
$counters = $queue->counters($owner);
} catch (RequestException $e) {
return redirect()->route('care.settings')->with('error', 'Could not reach Ladill Queue. Check API keys and enable integration in Queue settings.');
if ($queue->configured() && $e->response?->status() === 403) {
try {
$queue->syncIntegration($owner, true);
$counters = $queue->counters($owner);
} catch (RequestException) {
return redirect()->route('care.settings')->with('error', 'Ladill Queue integration is not enabled. Save settings with Queue integration checked, and enable Care in Queue settings.');
}
} else {
return redirect()->route('care.settings')->with('error', 'Could not reach Ladill Queue. Check API keys and enable integration in Queue settings.');
}
}
return view('care.service-queues.index', compact('counters', 'organization'));
@@ -63,7 +63,7 @@ class SettingsController extends Controller
$hadQueue = (bool) data_get($settings, 'queue_integration_enabled', false);
$settings['queue_integration_enabled'] = $wantsQueue;
if ($wantsQueue && ! $hadQueue && $queue->configured()) {
if ($wantsQueue && $queue->configured()) {
$branch = Branch::owned($owner)->where('organization_id', $organization->id)->orderBy('name')->first();
try {
$queue->enable($owner, $organization->name, $branch?->name);