Changeset View
Changeset View
Standalone View
Standalone View
src/app/Console/Commands/Domain/SetStatus.php
- This file was moved from src/app/Console/Commands/DomainSetStatus.php.
<?php | <?php | ||||
namespace App\Console\Commands; | namespace App\Console\Commands\Domain; | ||||
use App\Console\Command; | |||||
use App\Domain; | use App\Domain; | ||||
use Illuminate\Console\Command; | |||||
use Illuminate\Support\Facades\Queue; | use Illuminate\Support\Facades\Queue; | ||||
class DomainSetStatus extends Command | class SetStatus 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:set-status {domain} {status}'; | protected $signature = 'domain:set-status {domain} {status}'; | ||||
/** | /** | ||||
* The console command description. | * The console command description. | ||||
* | * | ||||
* @var string | * @var string | ||||
*/ | */ | ||||
protected $description = "Set a domain's status."; | protected $description = "Set a domain's status."; | ||||
/** | /** | ||||
* 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 = $this->getDomain($this->argument('domain')); | ||||
if (!$domain) { | if (!$domain) { | ||||
$this->error("Domain not found."); | |||||
return 1; | return 1; | ||||
} | } | ||||
Queue::fake(); // ignore LDAP for now | Queue::fake(); // ignore LDAP for now | ||||
$domain->status = (int) $this->argument('status'); | $domain->status = (int) $this->argument('status'); | ||||
$domain->save(); | $domain->save(); | ||||
$this->info($domain->status); | $this->info($domain->status); | ||||
} | } | ||||
} | } |