pixelfed/app/Http/Middleware/RedirectIfAuthenticated.php

28 lines
553 B
PHP
Raw Permalink Normal View History

2018-04-15 23:56:48 +00:00
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Support\Facades\Auth;
class RedirectIfAuthenticated
{
/**
* Handle an incoming request.
*
2018-08-28 03:07:36 +00:00
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param string|null $guard
*
2018-04-15 23:56:48 +00:00
* @return mixed
*/
public function handle($request, Closure $next, $guard = null)
{
if (Auth::guard($guard)->check()) {
return redirect('/home');
}
return $next($request);
}
}