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
lcom 0
cbo 1
dl 0
loc 20
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 8 2
1
<?php
2
/**
3
 * GitScrum v0.1.
4
 *
5
 * @author  Renato Marinho <[email protected]>
6
 * @license http://opensource.org/licenses/GPL-3.0 GPLv3
7
 */
8
9
namespace GitScrum\Http\Middleware;
10
11
use Closure;
12
use Illuminate\Support\Facades\Auth;
13
14
class RedirectIfAuthenticated
15
{
16
    /**
17
     * Handle an incoming request.
18
     *
19
     * @param \Illuminate\Http\Request $request
20
     * @param \Closure                 $next
21
     * @param string|null              $guard
22
     *
23
     * @return mixed
24
     */
25
    public function handle($request, Closure $next, $guard = null)
26
    {
27
        if (Auth::guard($guard)->check()) {
28
            return redirect()->route('user.dashboard');
29
        }
30
31
        return $next($request);
32
    }
33
}
34