Changeset View
Changeset View
Standalone View
Standalone View
src/app/Console/Commands/Wallet/SetBalanceCommand.php
- This file was moved from src/app/Console/Commands/WalletSetBalance.php.
<?php | <?php | ||||
namespace App\Console\Commands; | namespace App\Console\Commands\Wallet; | ||||
use App\Console\Command; | use App\Console\Command; | ||||
class WalletSetBalance extends Command | class SetBalanceCommand extends Command | ||||
{ | { | ||||
/** | /** | ||||
* The name and signature of the console command. | * The name and signature of the console command. | ||||
* | * | ||||
* @var string | * @var string | ||||
*/ | */ | ||||
protected $signature = 'wallet:set-balance {wallet} {balance}'; | protected $signature = 'wallet:set-balance {wallet} {balance}'; | ||||
Show All 9 Lines | class SetBalanceCommand extends Command | ||||
* | * | ||||
* @return mixed | * @return mixed | ||||
*/ | */ | ||||
public function handle() | public function handle() | ||||
{ | { | ||||
$wallet = $this->getWallet($this->argument('wallet')); | $wallet = $this->getWallet($this->argument('wallet')); | ||||
if (!$wallet) { | if (!$wallet) { | ||||
$this->error("Wallet not found."); | |||||
return 1; | return 1; | ||||
} | } | ||||
$wallet->balance = (int) $this->argument('balance'); | $wallet->balance = (int) $this->argument('balance'); | ||||
$wallet->save(); | $wallet->save(); | ||||
} | } | ||||
} | } |