You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
523 B

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