Files
ladill-pos/app/Http/Controllers/Api/Mini/SupportController.php
T
isaaccladandCursor e5d2b84388
Deploy Ladill Mini / deploy (push) Successful in 23s
Add Ladill POS v1 — register, Pay checkout, and commerce links.
Staff-facing counter register at pos.ladill.com with catalog cart, cash and
MoMo/card checkout via Ladill Pay, CRM timeline/import, invoice prefill, and
Merchant catalog import.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-23 22:52:24 +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);
}
}