0) { $code = strtoupper('GC' . bin2hex(random_bytes(4))); db()->insert('gift_cards', [ 'gift_card_id' => generateId('gc_'), 'code' => $code, 'initial_balance' => $initialBalance, 'current_balance' => $initialBalance, 'purchaser_email' => $purchaserEmail ?: null, 'recipient_email' => $recipientEmail ?: null, 'recipient_name' => $recipientName ?: null, 'message' => $message ?: null, 'is_active' => 1 ]); setFlash('success', "Gift card created! Code: $code"); // Send email if recipient provided if ($recipientEmail) { $html = <<
| Code | Recipient | Initial | Balance | Status | Created | Actions |
|---|---|---|---|---|---|---|
| No gift cards found | ||||||
| = htmlspecialchars($gc['code']) ?> | = htmlspecialchars($gc['recipient_email'] ?? $gc['recipient_name'] ?? '-') ?> | = formatCurrency($gc['initial_balance']) ?> | $0.00 = formatCurrency($gc['current_balance']) ?> | Disabled Depleted Active | = formatDate($gc['created_at']) ?> | |