UserLoginLogMiddleware   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 16
ccs 5
cts 5
cp 1
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 7 2
1
<?php
2
3
namespace Moecasts\Laravel\UserLoginLog\Middleware;
4
5
use Closure;
6
use Illuminate\Support\Facades\Auth;
7
8
class UserLoginLogMiddleware
9
{
10
    /**
11
     * Handle an incoming request.
12
     *
13
     * @param  \Illuminate\Http\Request  $request
14
     * @param  \Closure  $next
15
     * @return mixed
16
     */
17 2
    public function handle($request, Closure $next)
18
    {
19 2
        if (Auth::check()) {
20 1
            $user = Auth::user();
21 1
            $user->logLogin();
0 ignored issues
show
Bug introduced by
The method logLogin() does not exist on Illuminate\Contracts\Auth\Authenticatable. It seems like you code against a sub-type of Illuminate\Contracts\Auth\Authenticatable such as Illuminate\Foundation\Auth\User. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

21
            $user->/** @scrutinizer ignore-call */ 
22
                   logLogin();
Loading history...
22
        }
23 2
        return $next($request);
24
    }
25
}
26