Commit a98c0d64 authored by Taylor Otwell's avatar Taylor Otwell

Move middleware.

parent 97287c89
...@@ -11,7 +11,7 @@ class Kernel extends HttpKernel { ...@@ -11,7 +11,7 @@ class Kernel extends HttpKernel {
* @var array * @var array
*/ */
protected $middleware = [ protected $middleware = [
'App\Http\Middleware\UnderMaintenance', 'Illuminate\Foundation\Http\Middleware\UnderMaintenance',
'Illuminate\Cookie\Middleware\EncryptCookies', 'Illuminate\Cookie\Middleware\EncryptCookies',
'Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse', 'Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse',
'Illuminate\Session\Middleware\StartSession', 'Illuminate\Session\Middleware\StartSession',
......
<?php namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Response;
use Illuminate\Contracts\Routing\Middleware;
use Illuminate\Contracts\Foundation\Application;
class UnderMaintenance implements Middleware {
/**
* The application implementation.
*
* @var Application
*/
protected $app;
/**
* Create a new filter instance.
*
* @param Application $app
* @return void
*/
public function __construct(Application $app)
{
$this->app = $app;
}
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if ($this->app->isDownForMaintenance())
{
return new Response('Be right back!', 503);
}
return $next($request);
}
}
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