|
@@ -70,7 +70,7 @@ discard block |
|
|
block discarded – undo |
|
70
|
70
|
*/ |
|
71
|
71
|
protected function change(string $type, int $amount, ?array $meta, bool $confirmed): Transaction |
|
72
|
72
|
{ |
|
73
|
|
- return DB::transaction(function () use ($type, $amount, $meta, $confirmed) { |
|
|
73
|
+ return DB::transaction(function() use ($type, $amount, $meta, $confirmed) { |
|
74
|
74
|
|
|
75
|
75
|
$wallet = $this; |
|
76
|
76
|
if (!($this instanceof WalletModel)) { |
|
@@ -142,7 +142,7 @@ discard block |
|
|
block discarded – undo |
|
142
|
142
|
if ($this instanceof WalletModel) { |
|
143
|
143
|
$this->exists or $this->save(); |
|
144
|
144
|
if (!WalletProxy::has($this->getKey())) { |
|
145
|
|
- WalletProxy::set($this->getKey(), (int)($this->attributes['balance'] ?? 0)); |
|
|
145
|
+ WalletProxy::set($this->getKey(), (int) ($this->attributes['balance'] ?? 0)); |
|
146
|
146
|
} |
|
147
|
147
|
|
|
148
|
148
|
return WalletProxy::get($this->getKey()); |
|
@@ -192,7 +192,7 @@ discard block |
|
|
block discarded – undo |
|
192
|
192
|
*/ |
|
193
|
193
|
public function transfer(Wallet $wallet, int $amount, ?array $meta = null, string $status = Transfer::STATUS_TRANSFER): Transfer |
|
194
|
194
|
{ |
|
195
|
|
- return DB::transaction(function () use ($amount, $wallet, $meta, $status) { |
|
|
195
|
+ return DB::transaction(function() use ($amount, $wallet, $meta, $status) { |
|
196
|
196
|
$fee = Tax::fee($wallet, $amount); |
|
197
|
197
|
$withdraw = $this->withdraw($amount + $fee, $meta); |
|
198
|
198
|
$deposit = $wallet->deposit($amount, $meta); |
|
@@ -288,7 +288,7 @@ discard block |
|
|
block discarded – undo |
|
288
|
288
|
*/ |
|
289
|
289
|
public function forceTransfer(Wallet $wallet, int $amount, ?array $meta = null, string $status = Transfer::STATUS_TRANSFER): Transfer |
|
290
|
290
|
{ |
|
291
|
|
- return DB::transaction(function () use ($amount, $wallet, $meta, $status) { |
|
|
291
|
+ return DB::transaction(function() use ($amount, $wallet, $meta, $status) { |
|
292
|
292
|
$fee = Tax::fee($wallet, $amount); |
|
293
|
293
|
$withdraw = $this->forceWithdraw($amount + $fee, $meta); |
|
294
|
294
|
$deposit = $wallet->deposit($amount, $meta); |