2017-06-09 02:28:26 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Middleware;
|
|
|
|
|
2019-11-27 22:19:20 +08:00
|
|
|
use App\Contracts\Middleware;
|
2017-06-09 02:28:26 +08:00
|
|
|
use Closure;
|
2019-11-27 22:19:20 +08:00
|
|
|
use Illuminate\Http\Request;
|
2017-06-09 02:28:26 +08:00
|
|
|
use Illuminate\Support\Facades\Auth;
|
|
|
|
|
2019-11-27 22:19:20 +08:00
|
|
|
class RedirectIfAuthenticated implements Middleware
|
2017-06-09 02:28:26 +08:00
|
|
|
{
|
2019-11-27 22:19:20 +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);
|
|
|
|
}
|
|
|
|
}
|