Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
SendWelcomeNotification | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
30 | |
0.00% |
0 / 1 |
handle | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
30 |
1 | <?php |
2 | |
3 | namespace App\Listeners\User; |
4 | |
5 | use App\Events\User\Registered; |
6 | use Illuminate\Contracts\Queue\ShouldQueue; |
7 | use Illuminate\Support\Facades\Log; |
8 | |
9 | class SendWelcomeNotification implements ShouldQueue |
10 | { |
11 | public function handle(Registered $event): void |
12 | { |
13 | if (empty($event->user->email_verified_at)) { |
14 | return; |
15 | } |
16 | |
17 | // Send Welcome Notification only to users who were not created by the CreateUsers command script |
18 | $data = $event->requestData; |
19 | if ( |
20 | empty($data['created_by']) || (filled($data['created_by']) && $data['created_by'] !== 'admin') |
21 | ) { |
22 | $event->user->sendWelcomeNotification(); |
23 | } |
24 | } |
25 | } |