Changeset View
Changeset View
Standalone View
Standalone View
src/app/Console/Commands/User/WalletsCommand.php
- This file was moved from src/app/Console/Commands/UserWallets.php.
<?php | <?php | ||||
namespace App\Console\Commands; | namespace App\Console\Commands\User; | ||||
use App\Console\Command; | use App\Console\Command; | ||||
class UserWallets extends Command | class WalletsCommand extends Command | ||||
{ | { | ||||
/** | /** | ||||
* The name and signature of the console command. | * The name and signature of the console command. | ||||
* | * | ||||
* @var string | * @var string | ||||
*/ | */ | ||||
protected $signature = 'user:wallets {user}'; | protected $signature = 'user:wallets {user}'; | ||||
/** | /** | ||||
* The console command description. | * The console command description. | ||||
* | * | ||||
* @var string | * @var string | ||||
*/ | */ | ||||
protected $description = 'List wallets for a user'; | protected $description = "List a user's wallets."; | ||||
/** | /** | ||||
* Execute the console command. | * Execute the console command. | ||||
* | * | ||||
* @return mixed | * @return mixed | ||||
*/ | */ | ||||
public function handle() | public function handle() | ||||
{ | { | ||||
$user = $this->getUser($this->argument('user')); | $user = $this->getUser($this->argument('user')); | ||||
if (!$user) { | if (!$user) { | ||||
$this->error("User not found."); | |||||
return 1; | return 1; | ||||
} | } | ||||
foreach ($user->wallets as $wallet) { | foreach ($user->wallets as $wallet) { | ||||
$this->info("{$wallet->id} {$wallet->description}"); | $this->info("{$wallet->id} {$wallet->description}"); | ||||
} | } | ||||
} | } | ||||
} | } |