Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 8 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
UpdateHubspotContactTrigger | |
0.00% |
0 / 8 |
|
0.00% |
0 / 2 |
30 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
handle | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
20 |
1 | <?php |
2 | |
3 | namespace App\Listeners\Hubspot; |
4 | |
5 | use App\Events\User\LoggedOut; |
6 | use App\Http\Models\UserInfo; |
7 | use Illuminate\Contracts\Queue\ShouldQueue; |
8 | |
9 | class UpdateHubspotContactTrigger implements ShouldQueue |
10 | { |
11 | /** |
12 | * Create the event listener. |
13 | * |
14 | * @return void |
15 | */ |
16 | public function __construct() |
17 | { |
18 | // |
19 | } |
20 | |
21 | /** |
22 | * Handle the event. |
23 | */ |
24 | public function handle(LoggedOut $event): void |
25 | { |
26 | $data = $event->data; |
27 | $userInfo = UserInfo::where('email', $event->user->email)->first(); |
28 | |
29 | $userInfo->signed_into_flymsg_extension = 'No'; |
30 | |
31 | if (filled($event->data) && is_array($event->data) && !empty(array_filter($event->data))) { |
32 | $userInfo->sign_out_reason = ";{$data['selectedOption']}"; |
33 | $userInfo->sign_out_text = $data['description']; |
34 | } |
35 | |
36 | $userInfo->save(); |
37 | } |
38 | } |