Changeset View
Changeset View
Standalone View
Standalone View
src/app/Console/Commands/DomainSetStatus.php
- This file was copied from src/app/Console/Commands/DomainStatus.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; | ||||
use Illuminate\Support\Facades\Queue; | |||||
class DomainStatus extends Command | class DomainSetStatus 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:status {domain}'; | protected $signature = 'domain:set-status {domain} {status}'; | ||||
/** | /** | ||||
* The console command description. | * The console command description. | ||||
* | * | ||||
* @var string | * @var string | ||||
*/ | */ | ||||
protected $description = 'Display the status of a domain'; | protected $description = "Set a domain's status."; | ||||
/** | |||||
* Create a new command instance. | |||||
* | |||||
* @return void | |||||
*/ | |||||
public function __construct() | |||||
{ | |||||
parent::__construct(); | |||||
} | |||||
/** | /** | ||||
* Execute the console command. | * Execute the console command. | ||||
* | * | ||||
* @return mixed | * @return mixed | ||||
*/ | */ | ||||
public function handle() | public function handle() | ||||
{ | { | ||||
$domain = Domain::where('namespace', $this->argument('domain'))->first(); | $domain = Domain::where('namespace', $this->argument('domain'))->first(); | ||||
if (!$domain) { | if (!$domain) { | ||||
return 1; | return 1; | ||||
} | } | ||||
$this->info("Found domain: {$domain->id}"); | Queue::fake(); // ignore LDAP for now | ||||
$domain->status = (int) $this->argument('status'); | |||||
$domain->save(); | |||||
$this->info($domain->status); | $this->info($domain->status); | ||||
} | } | ||||
} | } |