Add application stack to app server provider.

This commit is contained in:
Taylor Otwell 2014-10-06 14:55:55 -05:00
parent ab53517076
commit 2893433b35
1 changed files with 18 additions and 5 deletions

View File

@ -1,6 +1,8 @@
<?php namespace App\Providers;
use Illuminate\Routing\Router;
use Illuminate\Support\ServiceProvider;
use Illuminate\Routing\Stack\Builder as Stack;
class AppServiceProvider extends ServiceProvider {
@ -11,7 +13,22 @@ class AppServiceProvider extends ServiceProvider {
*/
public function boot()
{
//
// This service provider is a convenient place to register your services
// in the IoC container. If you wish, you may make additional methods
// or service providers to keep the code more focused and granular.
$this->app->stack(function(Stack $stack, Router $router)
{
return $stack
->middleware('Illuminate\Cookie\Guard')
->middleware('Illuminate\Cookie\Queue')
->middleware('Illuminate\Session\Middlewares\Reader')
->middleware('Illuminate\Session\Middlewares\Writer')
->then(function($request) use ($router)
{
return $router->dispatch($request);
});
});
}
/**
@ -21,10 +38,6 @@ public function boot()
*/
public function register()
{
// This service provider is a convenient place to register your services
// in the IoC container. If you wish, you may make additional methods
// or service providers to keep the code more focused and granular.
//
}