phpvms/app/Http/Middleware/RedirectIfAuthenticated.php

21 lines
413 B
PHP
Raw Normal View History

2017-06-09 02:28:26 +08:00
<?php
namespace App\Http\Middleware;
use App\Contracts\Middleware;
2017-06-09 02:28:26 +08:00
use Closure;
use Illuminate\Http\Request;
2017-06-09 02:28:26 +08:00
use Illuminate\Support\Facades\Auth;
class RedirectIfAuthenticated implements Middleware
2017-06-09 02:28:26 +08:00
{
public function handle(Request $request, Closure $next, $guard = null)
2017-06-09 02:28:26 +08:00
{
if (Auth::guard($guard)->check()) {
2017-12-16 02:36:13 +08:00
return redirect('/');
2017-06-09 02:28:26 +08:00
}
return $next($request);
}
}