add un-confirm option to user:confirm, hide New button from dashboard if user isn't confirmed

This commit is contained in:
2018-08-11 21:28:42 +02:00
parent aa677efd51
commit ceca9af0fc
2 changed files with 12 additions and 4 deletions
+11 -3
View File
@@ -12,7 +12,7 @@ class ConfirmUser extends Command
*
* @var string
*/
protected $signature = 'user:confirm {user}';
protected $signature = 'user:confirm {user} {--undo}';
/**
* The console command description.
@@ -39,7 +39,15 @@ class ConfirmUser extends Command
public function handle()
{
$u = User::resolve($this->argument('user'));
$u->update(['confirmed' => true]);
$this->info("User #$u->id with e-mail $u->email and handle @$u->name was confirmed.");
$un='';
if ($this->hasOption('undo')) {
$u->update(['confirmed' => false]);
$un='un';
} else {
$u->update(['confirmed' => true]);
}
$this->info("User #$u->id with e-mail $u->email and handle @$u->name was {$un}confirmed.");
}
}