Created
October 23, 2014 12:28
-
-
Save alnutile/f16327a411ff4ea828e7 to your computer and use it in GitHub Desktop.
Quick auth for env = local or testing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php namespace App\Http\Middleware; | |
use AlfredNutileInc\QuickAuth\QuickAuthFacade; | |
use Closure; | |
use Illuminate\Contracts\Auth\Guard; | |
use Illuminate\Contracts\Routing\Middleware; | |
use Illuminate\Contracts\Routing\ResponseFactory; | |
class Authenticated implements Middleware { | |
/** | |
* The Guard implementation. | |
* | |
* @var Guard | |
*/ | |
protected $auth; | |
/** | |
* The response factory implementation. | |
* | |
* @var ResponseFactory | |
*/ | |
protected $response; | |
/** | |
* Create a new filter instance. | |
* | |
* @param Guard $auth | |
* @param ResponseFactory $response | |
* @return void | |
*/ | |
public function __construct(Guard $auth, | |
ResponseFactory $response) | |
{ | |
$this->auth = $auth; | |
$this->response = $response; | |
} | |
/** | |
* Handle an incoming request. | |
* | |
* @param \Illuminate\Http\Request $request | |
* @param \Closure $next | |
* @return mixed | |
*/ | |
public function handle($request, Closure $next) | |
{ | |
if($results = QuickAuthFacade::check()) | |
return $results; | |
return $next($request); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment