RedirectIfAuthenticated::handle()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 8
rs 9.4285
cc 2
eloc 4
nc 2
nop 3
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