From fcca3597785180137bb48f65493f39344f4b8fb2 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Wed, 5 Nov 2014 11:18:00 -0600 Subject: [PATCH] Working on middleware. --- app/Http/Middleware/Authenticated.php | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/app/Http/Middleware/Authenticated.php b/app/Http/Middleware/Authenticated.php index 575ba863..87c135c3 100644 --- a/app/Http/Middleware/Authenticated.php +++ b/app/Http/Middleware/Authenticated.php @@ -3,7 +3,6 @@ use Closure; use Illuminate\Contracts\Auth\Guard; use Illuminate\Contracts\Routing\Middleware; -use Illuminate\Contracts\Routing\ResponseFactory; class Authenticated implements Middleware { @@ -14,25 +13,15 @@ class Authenticated implements Middleware { */ 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) + public function __construct(Guard $auth) { $this->auth = $auth; - $this->response = $response; } /** @@ -48,11 +37,11 @@ class Authenticated implements Middleware { { if ($request->ajax()) { - return $this->response->make('Unauthorized', 401); + return response('Unauthorized.', 401); } else { - return $this->response->redirectGuest('auth/login'); + return redirect()->guest('auth/login'); } }