RedirectIfAuthenticated   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 21
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 8 2
1
<?php
2
3
namespace App\Ship\Middlewares\Http;
4
5
use Closure;
6
use Illuminate\Support\Facades\Auth;
7
8
/**
9
 * Class RedirectIfAuthenticated
10
 *
11
 * A.K.A app/Http/Middleware/RedirectIfAuthenticated.php
12
 *
13
 * @author  Mahmoud Zalt  <[email protected]>
14
 */
15
class RedirectIfAuthenticated
16
{
17
18
    /**
19
     * Handle an incoming request.
20
     *
21
     * @param  \Illuminate\Http\Request  $request
22
     * @param  \Closure  $next
23
     * @param  string|null  $guard
24
     * @return mixed
25
     */
26
    public function handle($request, Closure $next, $guard = null)
27
    {
28
        if (Auth::guard($guard)->check()) {
29
            return redirect('/home');
30
        }
31
32
        return $next($request);
33
    }
34
35
}
36