Changeset View
Changeset View
Standalone View
Standalone View
src/app/Console/Commands/UserStatus.php
<?php | <?php | ||||
namespace App\Console\Commands; | namespace App\Console\Commands; | ||||
use App\Console\Command; | |||||
use App\User; | use App\User; | ||||
use Illuminate\Console\Command; | |||||
class UserStatus extends Command | class UserStatus 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:status {user}'; | protected $signature = 'user:status {user}'; | ||||
/** | /** | ||||
* The console command description. | * The console command description. | ||||
* | * | ||||
* @var string | * @var string | ||||
*/ | */ | ||||
protected $description = 'Display the status of a user'; | protected $description = 'Display the status of a user'; | ||||
/** | /** | ||||
* 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() | ||||
{ | { | ||||
$user = User::where('email', $this->argument('user'))->first(); | $user = $this->getUser($this->argument('user')); | ||||
if (!$user) { | if (!$user) { | ||||
return 1; | return 1; | ||||
} | } | ||||
$statuses = [ | $statuses = [ | ||||
'active' => User::STATUS_ACTIVE, | 'active' => User::STATUS_ACTIVE, | ||||
'suspended' => User::STATUS_SUSPENDED, | 'suspended' => User::STATUS_SUSPENDED, | ||||
Show All 14 Lines |