| Code Coverage
| Classes and Traits | Functions and Methods | Lines
Total | 0.00% covered (danger) | 0.00% | 0 / 1 | 0.00% covered (danger) | 0.00% | 0 / 1 | CRAP | 0.00% covered (danger) | 0.00% | 0 / 3
RedirectIfAuthenticated | 0.00% covered (danger) | 0.00% | 0 / 1 | 0.00% covered (danger) | 0.00% | 0 / 1 | 6.00 | 0.00% covered (danger) | 0.00% | 0 / 3
handle | 0.00% covered (danger) | 0.00% | 0 / 1 | 6.00 | 0.00% covered (danger) | 0.00% | 0 / 3

1 | <?php
2 |
3 | namespace App\Http\Middleware;
4 |
5 | use Closure;
6 | use Illuminate\Support\Facades\Auth;
7 |
8 | class RedirectIfAuthenticated
9 | {
10 | /**
11 | * Handle an incoming request.
12 | *
13 | * @param \Illuminate\Http\Request $request
14 | * @param \Closure $next
15 | * @param string|null $guard
16 | * @return mixed
17 | */
18 | public function handle($request, Closure $next, $guard = null)
19 | {
20 | if (Auth::guard($guard)->check()) {
21 | return redirect('/home');
22 | }
23 |
24 | return $next($request);
25 | }
26 | }