firefly-iii/app/Http/Middleware/RedirectIfAuthenticated.php

39 lines
861 B
PHP
Raw Normal View History

<?php
2017-09-14 10:40:02 -05:00
declare(strict_types=1);
/**
* RedirectIfAuthenticated.php
* Copyright (c) 2017 thegrumpydictator@gmail.com
* This software may be modified and distributed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International License.
*
* See the LICENSE file for details.
*/
namespace FireflyIII\Http\Middleware;
2015-02-05 21:39:52 -06:00
use Closure;
use Illuminate\Support\Facades\Auth;
2015-02-05 21:39:52 -06:00
2015-02-11 00:35:10 -06:00
class RedirectIfAuthenticated
{
/**
* Handle an incoming request.
*
2017-09-14 10:40:02 -05:00
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param string|null $guard
*
2015-02-11 00:35:10 -06:00
* @return mixed
*/
public function handle($request, Closure $next, $guard = null)
2015-02-11 00:35:10 -06:00
{
if (Auth::guard($guard)->check()) {
2017-09-09 15:02:20 -05:00
return redirect('/home');
2015-02-11 00:35:10 -06:00
}
2015-02-05 21:39:52 -06:00
2015-02-11 00:35:10 -06:00
return $next($request);
}
2015-02-05 21:39:52 -06:00
}