RedirectIfAuthenticated   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 8 2
1
<?php
2
3
/*
4
 * rmarchiv.tk
5
 * (c) 2016-2017 by Marcel 'ryg' Hering
6
 */
7
8
namespace App\Http\Middleware;
9
10
use Closure;
11
use Illuminate\Support\Facades\Auth;
12
13
class RedirectIfAuthenticated
14
{
15
    /**
16
     * Handle an incoming request.
17
     *
18
     * @param \Illuminate\Http\Request $request
19
     * @param \Closure                 $next
20
     * @param string|null              $guard
21
     *
22
     * @return mixed
23
     */
24
    public function handle($request, Closure $next, $guard = null)
25
    {
26
        if (Auth::guard($guard)->check()) {
27
            return redirect('/home');
28
        }
29
30
        return $next($request);
31
    }
32
}
33