Changeset View
Changeset View
Standalone View
Standalone View
src/app/Console/Commands/User/DomainsCommand.php
- This file was moved from src/app/Console/Commands/UserDomains.php.
<?php | <?php | ||||
namespace App\Console\Commands; | namespace App\Console\Commands\User; | ||||
use App\Console\Command; | use App\Console\Command; | ||||
class UserDomains extends Command | class DomainsCommand 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:domains {userid}'; | protected $signature = 'user:domains {user}'; | ||||
/** | /** | ||||
* The console command description. | * The console command description. | ||||
* | * | ||||
* @var string | * @var string | ||||
*/ | */ | ||||
protected $description = 'Command description'; | protected $description = "List a user's domains."; | ||||
/** | /** | ||||
* Execute the console command. | * Execute the console command. | ||||
* | * | ||||
* @return mixed | * @return mixed | ||||
*/ | */ | ||||
public function handle() | public function handle() | ||||
{ | { | ||||
$user = $this->getUser($this->argument('userid')); | $user = $this->getUser($this->argument('user')); | ||||
if (!$user) { | if (!$user) { | ||||
$this->error("User not found."); | |||||
return 1; | return 1; | ||||
} | } | ||||
foreach ($user->domains() as $domain) { | foreach ($user->domains() as $domain) { | ||||
$this->info("{$domain->namespace}"); | $this->info($domain->namespace); | ||||
} | } | ||||
} | } | ||||
} | } |