Deploy Ladill Mini / deploy (push) Successful in 23s
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>
57 lines
1.8 KiB
PHP
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);
|
|
}
|
|
}
|