NotifyNewUser   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 5
c 1
b 0
f 0
dl 0
loc 14
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 9 1
1
<?php
2
3
namespace App\Listeners\Notify;
4
5
use Illuminate\Support\Str;
6
use App\Events\Admin\NewUserCreated;
7
use App\Models\UserInitialize;
8
use App\Notifications\SendWelcomeEmail;
9
use Illuminate\Contracts\Queue\ShouldQueue;
10
use Illuminate\Queue\InteractsWithQueue;
11
use Illuminate\Support\Facades\Notification;
12
13
class NotifyNewUser implements ShouldQueue
14
{
15
    /**
16
     * Handle the event
17
     */
18
    public function handle(NewUserCreated $event)
19
    {
20
        //  Create a User Initialization Link
21
        UserInitialize::create([
22
            'username' => $event->user->username,
23
            'token'    => $token = Str::uuid(),
24
        ]);
25
26
        Notification::send($event->user, new SendWelcomeEmail($token));
27
    }
28
}
29