Changeset View
Changeset View
Standalone View
Standalone View
src/app/Console/Commands/DomainList.php
- This file was copied to src/app/Console/Commands/DomainDelete.php, src/app/Console/Commands/UserDelete.php, src/app/Console/Commands/WalletGetBalance.php, src/app/Console/Commands/WalletSetBalance.php.
<?php | <?php | ||||
namespace App\Console\Commands; | namespace App\Console\Commands; | ||||
use App\Domain; | use App\Domain; | ||||
use Illuminate\Console\Command; | use Illuminate\Console\Command; | ||||
class DomainList extends Command | class DomainList extends Command | ||||
{ | { | ||||
/** | /** | ||||
* The name and signature of the console command. | * The name and signature of the console command. | ||||
* | * | ||||
* @var string | * @var string | ||||
*/ | */ | ||||
protected $signature = 'domain:list'; | protected $signature = 'domain:list {--deleted}'; | ||||
/** | /** | ||||
* The console command description. | * The console command description. | ||||
* | * | ||||
* @var string | * @var string | ||||
*/ | */ | ||||
protected $description = 'List domains'; | protected $description = 'List domains'; | ||||
Show All 9 Lines | class DomainList extends Command | ||||
/** | /** | ||||
* Execute the console command. | * Execute the console command. | ||||
* | * | ||||
* @return mixed | * @return mixed | ||||
*/ | */ | ||||
public function handle() | public function handle() | ||||
{ | { | ||||
$domains = Domain::withTrashed()->orderBy('namespace')->each( | if ($this->option('deleted')) { | ||||
$domains = Domain::withTrashed()->orderBy('namespace'); | |||||
} else { | |||||
$domains = Domain::orderBy('namespace'); | |||||
} | |||||
$domains->each( | |||||
function ($domain) { | function ($domain) { | ||||
$this->info($domain->namespace); | $msg = $domain->namespace; | ||||
if ($domain->deleted_at) { | |||||
$msg .= " (deleted at {$domain->deleted_at})"; | |||||
} | |||||
$this->info($msg); | |||||
} | } | ||||
); | ); | ||||
} | } | ||||
} | } |