Completed
Push — dev ( 7e5692...f2c1ea )
by Darko
08:12
created

UpdateUserLoggedIn   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 4
dl 0
loc 24
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 2 1
A handle() 0 6 1
1
<?php
2
3
namespace App\Listeners;
4
5
use App\Events\UserLoggedIn;
6
use App\Models\User;
7
use Illuminate\Queue\InteractsWithQueue;
8
use Illuminate\Contracts\Queue\ShouldQueue;
9
10
class UpdateUserLoggedIn
11
{
12
    /**
13
     * Create the event listener.
14
     *
15
     * @return void
16
     */
17
    public function __construct()
18
    {
19
        //
20
    }
21
22
    /**
23
     * Handle the event.
24
     *
25
     * @param  UserLoggedIn  $event
26
     * @return void
27
     */
28
    public function handle(UserLoggedIn $event)
29
    {
30
        User::find($event->user->id)->update(
31
            [
32
                'lastlogin' => now(),
33
                'host' => $event->ip,
34
            ]
35
        );
36
    }
37
}
38