Files
ladill-mini/app/Http/Controllers/Api/Mini/SupportController.php
T
isaaccladandClaude Opus 4.8 3406bd730a
Deploy Ladill Mini / deploy (push) Successful in 28s
Mini API: support ticket endpoints (replaces Afia support chat).
Support is now a ticket system proxied to the central identity support API:
GET/POST /mini/support/tickets and GET /mini/support/tickets/{id}. Removed the
Afia-backed /support/chat route.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-11 12:29:35 +00:00

57 lines
1.8 KiB
PHP

<?php
namespace App\Http\Controllers\Api\Mini;
use App\Http\Controllers\Api\Concerns\CallsIdentityApi;
use App\Http\Controllers\Controller;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
/**
* Support tickets — proxies to the central support system (auth.ladill.com),
* so tickets land in the same admin support queue as every other Ladill app.
*/
class SupportController extends Controller
{
use CallsIdentityApi;
public function tickets(): JsonResponse
{
$response = $this->identitySend('GET', '/api/identity/support/tickets?user='.urlencode((string) ladill_account()->public_id), []);
return response()->json(['data' => $response->json('data', [])]);
}
public function ticket(int $ticket): JsonResponse
{
$response = $this->identitySend(
'GET',
'/api/identity/support/tickets/'.$ticket.'?user='.urlencode((string) ladill_account()->public_id),
[],
);
if ($response->status() === 404) {
return response()->json(['message' => 'Ticket not found.'], 404);
}
return response()->json(['data' => $response->json('data')]);
}
public function store(Request $request): JsonResponse
{
$data = $request->validate([
'subject' => ['required', 'string', 'max:255'],
'message' => ['required', 'string', 'max:5000'],
'priority' => ['sometimes', 'in:low,normal,high'],
]);
$response = $this->identitySend('POST', '/api/identity/support/tickets', array_merge(
['user' => ladill_account()->public_id],
$data,
));
$this->rethrowValidation($response, 'subject');
return response()->json(['data' => $response->json('data')], 201);
}
}