@@ 11-45 (lines=35) @@ | ||
8 | use Illuminate\Support\Facades\Log; |
|
9 | use Afrittella\BackProject\Notifications\RegistrationEmail; |
|
10 | ||
11 | class SendRegistrationEmail implements ShouldQueue |
|
12 | { |
|
13 | protected $users; |
|
14 | /** |
|
15 | * Create the event listener. |
|
16 | * |
|
17 | */ |
|
18 | public function __construct(Users $users) |
|
19 | { |
|
20 | $this->users = $users; |
|
21 | } |
|
22 | ||
23 | /** |
|
24 | * Handle the event. |
|
25 | * |
|
26 | * @param UserRegistered $event |
|
27 | * @return void |
|
28 | * @internal param $Event =UserRegistered $event |
|
29 | */ |
|
30 | public function handle(UserRegistered $event) |
|
31 | { |
|
32 | //try { |
|
33 | $user = $this->users->findBy('id', $event->user_id); |
|
34 | $user->notify(new RegistrationEmail($user)); |
|
35 | //} catch(\Exception $e) { |
|
36 | //Log::error('lavoro fallito'); |
|
37 | //} |
|
38 | ||
39 | } |
|
40 | ||
41 | public function failed(UserRegistered $event, $exception) |
|
42 | { |
|
43 | Log::error('fallito '); |
|
44 | } |
|
45 | } |
|
46 |
@@ 10-43 (lines=34) @@ | ||
7 | use Illuminate\Support\Facades\Log; |
|
8 | use Afrittella\BackProject\Notifications\RegistrationEmail; |
|
9 | ||
10 | class SendRegistrationEmailNoQueue |
|
11 | { |
|
12 | protected $users; |
|
13 | /** |
|
14 | * Create the event listener. |
|
15 | * |
|
16 | */ |
|
17 | public function __construct(Users $users) |
|
18 | { |
|
19 | $this->users = $users; |
|
20 | } |
|
21 | ||
22 | /** |
|
23 | * Handle the event. |
|
24 | * |
|
25 | * @param vent=UserRegistered $event |
|
26 | * @return void |
|
27 | */ |
|
28 | public function handle(UserRegistered $event) |
|
29 | { |
|
30 | //try { |
|
31 | $user = $this->users->findBy('id', $event->user_id); |
|
32 | $user->notify(new RegistrationEmail($user)); |
|
33 | //} catch(\Exception $e) { |
|
34 | //Log::error('lavoro fallito'); |
|
35 | //} |
|
36 | ||
37 | } |
|
38 | ||
39 | public function failed(UserRegistered $event, $exception) |
|
40 | { |
|
41 | Log::error('fallito '); |
|
42 | } |
|
43 | } |
|
44 |