for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the Tinyissue package.
*
* (c) Mohamed Alsharaf <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Tinyissue\Http\Middleware;
use Closure;
use Illuminate\Contracts\Auth\Guard;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
/**
* RedirectIfAuthenticated is a Middleware class to redirect logged user to dashboard instead of login page.
* @author Mohamed Alsharaf <[email protected]>
class RedirectIfAuthenticated
{
* The Guard implementation.
* @var Guard
protected $auth;
* Create a new filter instance.
* @param Guard $auth
public function __construct(Guard $auth)
$this->auth = $auth;
}
* Handle an incoming request.
* @param Request $request
* @param \Closure $next
* @return mixed
public function handle(Request $request, Closure $next)
if ($this->auth->check()) {
return new RedirectResponse(url('/home'));
return $next($request);