-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathConfirmAllEmails.php
45 lines (38 loc) · 1 KB
/
ConfirmAllEmails.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
namespace App\Console\Commands;
use App\Models\User;
use Illuminate\Auth\Events\Verified;
use Illuminate\Console\Command;
use Exception;
class ConfirmAllEmails extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'admin:confirm-all-emails';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Marks the emails of all registered users as confirmed';
/**
* Execute the console command.
*/
public function handle()
{
try {
User::all()->each(function ($user) {
$user->update([
'email_verified_at' => now()->timestamp
]);
$user->createTicket();
});
$this->info('All emails are marked as confirmed successfully');
} catch (Exception) {
$this->error('The emails could not be marked as confirmed');
}
}
}