RedirectIfAuthenticated.php 454 B

12345678910111213141516171819202122232425
  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. * @return mixed
  13. */
  14. public function handle($request, Closure $next)
  15. {
  16. if (Auth::check()) {
  17. return redirect('/');
  18. }
  19. return $next($request);
  20. }
  21. }