.
This commit is contained in:
@@ -14,6 +14,7 @@ use Rooyesh\Wallet\interfaces\TransactionInterface;
|
|||||||
use Rooyesh\Wallet\interfaces\WalletInterface;
|
use Rooyesh\Wallet\interfaces\WalletInterface;
|
||||||
use App\Services\ConfigService;
|
use App\Services\ConfigService;
|
||||||
use App\Services\PargarSyncService;
|
use App\Services\PargarSyncService;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
|
||||||
class GiftCardController extends Controller
|
class GiftCardController extends Controller
|
||||||
@@ -454,10 +455,9 @@ class GiftCardController extends Controller
|
|||||||
$unit = (int) $request->unit;
|
$unit = (int) $request->unit;
|
||||||
$unitAmount = $unit === 3 ? $amount / 100 : $amount;
|
$unitAmount = $unit === 3 ? $amount / 100 : $amount;
|
||||||
|
|
||||||
$gift = GiftCard::create([
|
$giftData = [
|
||||||
'customer_id' => $customer?->id,
|
'customer_id' => $customer?->id,
|
||||||
'use_once' => $request->use_once ? 1 : 0,
|
'use_once' => $request->use_once ? 1 : 0,
|
||||||
'show_in_app' => $customer ? 0 : ($request->boolean('show_in_app') ? 1 : 0),
|
|
||||||
'count' => $count,
|
'count' => $count,
|
||||||
'amount' => $unitAmount,
|
'amount' => $unitAmount,
|
||||||
'mobile' => $customer?->mobile ?? $request->mobile ?? null,
|
'mobile' => $customer?->mobile ?? $request->mobile ?? null,
|
||||||
@@ -469,7 +469,11 @@ class GiftCardController extends Controller
|
|||||||
'created_at' => now(),
|
'created_at' => now(),
|
||||||
'updated_at' => now(),
|
'updated_at' => now(),
|
||||||
'description' => $request->description,
|
'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 = [];
|
$codeRows = [];
|
||||||
for ($i = 0; $i < $count; $i++) {
|
for ($i = 0; $i < $count; $i++) {
|
||||||
|
|||||||
Reference in New Issue
Block a user