From f1c68d955db5d34c089e4e03da5982a4d7629419 Mon Sep 17 00:00:00 2001 From: safavimohadeseh78 Date: Tue, 6 Oct 2026 13:40:00 +0330 Subject: [PATCH] . --- app/Http/Controllers/Admin/GiftCardController.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/Admin/GiftCardController.php b/app/Http/Controllers/Admin/GiftCardController.php index a3b587c..4fc3b56 100644 --- a/app/Http/Controllers/Admin/GiftCardController.php +++ b/app/Http/Controllers/Admin/GiftCardController.php @@ -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++) {