RedirectIfAuthenticated   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 19
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\Features\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
     * Handle an incoming request.
19
     *
20
     * @param  \Illuminate\Http\Request  $request
21
     * @param  \Closure  $next
22
     * @param  string|null  $guard
23
     * @return mixed
24
     */
25
    public function handle($request, Closure $next, $guard = null)
26
    {
27
        if (Auth::guard($guard)->check()) {
28
            return redirect('/home');
29
        }
30
31
        return $next($request);
32
    }
33
}
34