Files
portal-api/app/Http/Controllers/Api/Client/Service/ServiceRenewalOptionsController.php
T
baodev0andClaude Sonnet 5.5 55a834a2f8 feat: nhắc gia hạn QR theo dịch vụ, failover server hosting, CCCD admin, log cấp phát dịch vụ
- Mail campaign: mẫu nhắc gia hạn thanh toán QR, chọn dịch vụ + chu kỳ từng dòng (renewal_services)
- Hosting: nhiều server Plesk cho một gói (service_plan_servers), chuyển server khi server chết
- Admin xem/sửa giấy tờ định danh khách, tuỳ chọn gia hạn cho khách, nhật ký cấp phát dịch vụ
- Đánh dấu mẫu email dịch vụ là non-marketing

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-30 18:36:41 +07:00

31 lines
924 B
PHP

<?php
namespace App\Http\Controllers\Api\Client\Service;
use App\Http\Controllers\Controller;
use App\Models\Service;
use App\Support\RenewalPricing;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class ServiceRenewalOptionsController extends Controller
{
public function __invoke(Request $request, string $uuid): JsonResponse
{
$service = Service::with(['orderItem.product', 'product', 'customProduct'])
->where('uuid', $uuid)
->where('customer_id', $request->user()->id)
->firstOrFail();
$source = $service->customProduct ?? $service->orderItem?->product ?? $service->product;
return response()->json([
'error' => false,
'data' => [
'options' => RenewalPricing::options($source),
'addon_total' => RenewalPricing::addonTotal($service, 1),
],
]);
}
}