From 77da9ad8e912f3559204e33d71f9e701029c3efc Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Fri, 6 Dec 2024 00:44:16 -0700 Subject: [PATCH] Update UserVerifyEmail command --- app/Console/Commands/UserVerifyEmail.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/Console/Commands/UserVerifyEmail.php b/app/Console/Commands/UserVerifyEmail.php index 3b3cac5ef..b0461ca79 100644 --- a/app/Console/Commands/UserVerifyEmail.php +++ b/app/Console/Commands/UserVerifyEmail.php @@ -5,8 +5,9 @@ namespace App\Console\Commands; use Illuminate\Console\Command; use Illuminate\Support\Str; use App\User; +use Illuminate\Contracts\Console\PromptsForMissingInput; -class UserVerifyEmail extends Command +class UserVerifyEmail extends Command implements PromptsForMissingInput { /** * The name and signature of the console command. @@ -39,13 +40,19 @@ class UserVerifyEmail extends Command */ public function handle() { - $user = User::whereUsername($this->argument('username'))->first(); + $username = $this->argument('username'); + $user = User::whereUsername($username)->first(); if(!$user) { $this->error('Username not found'); return; } + if($user->email_verified_at) { + $this->error('Email already verified ' . $user->email_verified_at->diffForHumans()); + return; + } + $user->email_verified_at = now(); $user->save(); $this->info('Successfully verified email address for ' . $user->username);