Replace Upgrade to Pro with Report Issue for staff.
Deploy Ladill Care / deploy (push) Successful in 1m4s

Non-owners submit tickets to Ladill admin via Identity support API.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-07-14 22:23:47 +00:00
co-authored by Cursor
parent 3a7bd14b2b
commit c425aa12ac
5 changed files with 160 additions and 12 deletions
+23 -3
View File
@@ -78,6 +78,24 @@ class IdentityTeamClient
return (array) $response->json('data', []);
}
/**
* @param array{subject: string, message: string, priority?: string, tags?: list<string>} $payload
* @return array<string, mixed>
*/
public function createSupportTicket(string $userPublicId, array $payload, string $app = 'care'): array
{
$response = $this->request('post', '/identity/support/tickets', array_filter([
'user' => $userPublicId,
'subject' => $payload['subject'] ?? '',
'message' => $payload['message'] ?? '',
'priority' => $payload['priority'] ?? 'normal',
'app' => $app,
'tags' => $payload['tags'] ?? ['staff_issue'],
], fn ($value) => $value !== null && $value !== ''));
return (array) $response->json('data', []);
}
private function request(string $method, string $path, array $query = []): Response
{
$url = rtrim((string) config('identity.api_url'), '/').$path;
@@ -87,9 +105,11 @@ class IdentityTeamClient
throw new RuntimeException('Identity API is not configured.');
}
$response = Http::withToken($key)
->timeout(10)
->{$method}($url, $query);
$http = Http::withToken($key)->timeout(10);
$response = $method === 'post'
? $http->post($url, $query)
: $http->{$method}($url, $query);
if (! $response->successful()) {
throw new RuntimeException($response->json('message') ?: 'Identity API request failed.');