for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* @package Dashboard
* @author Ian Olson <[email protected]>
* @license MIT
* @copyright 2015, Laraflock
* @link https://github.com/laraflock
*/
namespace Laraflock\Dashboard\Middleware;
use Closure;
use Illuminate\Http\Request;
use Laracasts\Flash\Flash;
use Laraflock\Dashboard\Repositories\Auth\AuthRepositoryInterface as Auth;
class UserMiddleware
{
* Auth interface.
*
* @var Auth
protected $auth;
* The constructor.
* @param Auth $auth
public function __construct(Auth $auth)
$this->auth = $auth;
}
* Check if a user is logged in.
* @param Request $request
* @param Closure $next
* @return \Illuminate\Http\RedirectResponse
public function handle(Request $request, Closure $next)
if (!$this->auth->check()) {
Flash::error(trans('dashboard::dashboard.flash.access_denied'));
return redirect()->route('auth.login');
return $next($request);