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

pull/35/head
Ondřej Hruška 6 years ago
parent aa677efd51
commit ceca9af0fc
Signed by: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 14
      app/Console/Commands/ConfirmUser.php
  2. 2
      resources/views/welcome.blade.php

@ -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.");
}
}

@ -50,7 +50,7 @@
{{ $tables->links(null, ['ulClass' => 'pagination-sm mb-0 pagination-outline-light']) }}
</nav>
@if(authed())
@if(authed() && user()->confirmed)
<a href="{{route('table.create')}}" class="btn ml-3" aria-label="New Table">New</a>
@endif
</div>

Loading…
Cancel
Save