This commit is contained in:
2026-10-06 13:40:00 +03:30
parent a42261c06e
commit f1c68d955d
@@ -14,6 +14,7 @@ use Rooyesh\Wallet\interfaces\TransactionInterface;
use Rooyesh\Wallet\interfaces\WalletInterface;
use App\Services\ConfigService;
use App\Services\PargarSyncService;
use Illuminate\Support\Facades\Schema;
class GiftCardController extends Controller
@@ -454,10 +455,9 @@ class GiftCardController extends Controller
$unit = (int) $request->unit;
$unitAmount = $unit === 3 ? $amount / 100 : $amount;
$gift = GiftCard::create([
$giftData = [
'customer_id' => $customer?->id,
'use_once' => $request->use_once ? 1 : 0,
'show_in_app' => $customer ? 0 : ($request->boolean('show_in_app') ? 1 : 0),
'count' => $count,
'amount' => $unitAmount,
'mobile' => $customer?->mobile ?? $request->mobile ?? null,
@@ -469,7 +469,11 @@ class GiftCardController extends Controller
'created_at' => now(),
'updated_at' => now(),
'description' => $request->description,
]);
];
if (Schema::hasColumn('giftcards', 'show_in_app')) {
$giftData['show_in_app'] = $customer ? 0 : ($request->boolean('show_in_app') ? 1 : 0);
}
$gift = GiftCard::create($giftData);
$codeRows = [];
for ($i = 0; $i < $count; $i++) {