Skip to content

Commit 77da9ad

Browse files
committed
Update UserVerifyEmail command
1 parent 222d577 commit 77da9ad

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

app/Console/Commands/UserVerifyEmail.php

+9-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
use Illuminate\Console\Command;
66
use Illuminate\Support\Str;
77
use App\User;
8+
use Illuminate\Contracts\Console\PromptsForMissingInput;
89

9-
class UserVerifyEmail extends Command
10+
class UserVerifyEmail extends Command implements PromptsForMissingInput
1011
{
1112
/**
1213
* The name and signature of the console command.
@@ -39,13 +40,19 @@ public function __construct()
3940
*/
4041
public function handle()
4142
{
42-
$user = User::whereUsername($this->argument('username'))->first();
43+
$username = $this->argument('username');
44+
$user = User::whereUsername($username)->first();
4345

4446
if(!$user) {
4547
$this->error('Username not found');
4648
return;
4749
}
4850

51+
if($user->email_verified_at) {
52+
$this->error('Email already verified ' . $user->email_verified_at->diffForHumans());
53+
return;
54+
}
55+
4956
$user->email_verified_at = now();
5057
$user->save();
5158
$this->info('Successfully verified email address for ' . $user->username);

0 commit comments

Comments
 (0)