Commit 076d86bf authored by Taylor Otwell's avatar Taylor Otwell

Simplifying some filters.

parent 986c964c
<?php namespace App\Http\Filters; <?php namespace App\Http\Filters;
use Illuminate\Contracts\Routing\ResponseFactory; use Illuminate\Http\RedirectResponse;
class GuestFilter { class GuestFilter {
...@@ -11,24 +11,15 @@ class GuestFilter { ...@@ -11,24 +11,15 @@ class GuestFilter {
*/ */
protected $auth; protected $auth;
/**
* The response factory implementation.
*
* @var ResponseFactory
*/
protected $response;
/** /**
* Create a new filter instance. * Create a new filter instance.
* *
* @param Authenticator $auth * @param Authenticator $auth
* @return void * @return void
*/ */
public function __construct(Authenticator $auth, public function __construct(Authenticator $auth)
ResponseFacotry $response)
{ {
$this->auth = $auth; $this->auth = $auth;
$this->response = $response;
} }
/** /**
...@@ -40,7 +31,7 @@ class GuestFilter { ...@@ -40,7 +31,7 @@ class GuestFilter {
{ {
if ($this->auth->check()) if ($this->auth->check())
{ {
return $this->response->redirectTo('/'); return new RedirectResponse(url('/'));
} }
} }
......
<?php namespace App\Http\Filters; <?php namespace App\Http\Filters;
use Illuminate\Http\Response;
use Illuminate\Contracts\Foundation\Application; use Illuminate\Contracts\Foundation\Application;
use Illuminate\Contracts\Routing\ResponseFactory;
class MaintenanceFilter { class MaintenanceFilter {
...@@ -12,23 +12,15 @@ class MaintenanceFilter { ...@@ -12,23 +12,15 @@ class MaintenanceFilter {
*/ */
protected $app; protected $app;
/**
* The response factory implementation.
*
* @var ResponseFactory
*/
protected $response;
/** /**
* Create a new filter instance. * Create a new filter instance.
* *
* @param Application $app * @param Application $app
* @return void * @return void
*/ */
public function __construct(Application $app, ResponseFactory $response) public function __construct(Application $app)
{ {
$this->app = $app; $this->app = $app;
$this->response = $response;
} }
/** /**
...@@ -40,7 +32,7 @@ class MaintenanceFilter { ...@@ -40,7 +32,7 @@ class MaintenanceFilter {
{ {
if ($this->app->isDownForMaintenance()) if ($this->app->isDownForMaintenance())
{ {
return $this->response->make('Be right back!', 503); return new Response('Be right back!', 503);
} }
} }
......
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