Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 9 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
LogSignOutReason | |
0.00% |
0 / 9 |
|
0.00% |
0 / 2 |
30 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
handle | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
20 |
1 | <?php |
2 | |
3 | namespace App\Listeners\User; |
4 | |
5 | use App\Events\User\LoggedOut; |
6 | use App\Http\Models\Auth\LogoutHistory; |
7 | use Illuminate\Contracts\Queue\ShouldQueue; |
8 | |
9 | class LogSignOutReason 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 | if (filled($event->data) && is_array($event->data)) { |
27 | if (!!array_filter($event->data)) { |
28 | LogoutHistory::create([ |
29 | 'user_id' => $event->user->id, |
30 | 'email' => $event->user->email, |
31 | 'description' => $event->data['description'], |
32 | 'selected_reason_for_signout' => $event->data['selectedOption'], |
33 | ]); |
34 | } |
35 | } |
36 | } |
37 | } |