Completed
Push — master ( 6e8c16...bdc137 )
by wen
03:38
created

RedirectIfAuthenticated::handle()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
ccs 0
cts 7
cp 0
rs 9.4285
cc 2
eloc 4
nc 2
nop 3
crap 6
1
<?php
2
3
namespace Sco\Admin\Middleware;
4
5
use Auth;
6
use Closure;
7
use Illuminate\Http\Request;
8
9
class RedirectIfAuthenticated
10
{
11
    /**
12
     * Handle an incoming request.
13
     *
14
     * @param \Illuminate\Http\Request $request
15
     * @param \Closure                 $next
16
     * @param string|null              $guard
17
     *
18
     * @return mixed
19
     */
20
    public function handle(Request $request, Closure $next, $guard = null)
0 ignored issues
show
Unused Code introduced by
The parameter $guard is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
21
    {
22
        if (Auth::guard(config('admin.guard'))->check()) {
23
            return redirect()->route('admin.index');
24
        }
25
26
        return $next($request);
27
    }
28
}
29