Commit fcca3597 authored by Taylor Otwell's avatar Taylor Otwell

Working on middleware.

parent d5e5947a
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
use Closure; use Closure;
use Illuminate\Contracts\Auth\Guard; use Illuminate\Contracts\Auth\Guard;
use Illuminate\Contracts\Routing\Middleware; use Illuminate\Contracts\Routing\Middleware;
use Illuminate\Contracts\Routing\ResponseFactory;
class Authenticated implements Middleware { class Authenticated implements Middleware {
...@@ -14,25 +13,15 @@ class Authenticated implements Middleware { ...@@ -14,25 +13,15 @@ class Authenticated implements Middleware {
*/ */
protected $auth; protected $auth;
/**
* The response factory implementation.
*
* @var ResponseFactory
*/
protected $response;
/** /**
* Create a new filter instance. * Create a new filter instance.
* *
* @param Guard $auth * @param Guard $auth
* @param ResponseFactory $response
* @return void * @return void
*/ */
public function __construct(Guard $auth, public function __construct(Guard $auth)
ResponseFactory $response)
{ {
$this->auth = $auth; $this->auth = $auth;
$this->response = $response;
} }
/** /**
...@@ -48,11 +37,11 @@ class Authenticated implements Middleware { ...@@ -48,11 +37,11 @@ class Authenticated implements Middleware {
{ {
if ($request->ajax()) if ($request->ajax())
{ {
return $this->response->make('Unauthorized', 401); return response('Unauthorized.', 401);
} }
else else
{ {
return $this->response->redirectGuest('auth/login'); return redirect()->guest('auth/login');
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment