diff --git a/_docs/1-Installation-and-Setup.md b/_docs/1-Installation-and-Setup.md index aba8349..a86f0bd 100644 --- a/_docs/1-Installation-and-Setup.md +++ b/_docs/1-Installation-and-Setup.md @@ -56,6 +56,23 @@ Once the package is installed, you can register the service provider in `config/ > No need to register the Localization facade, it's done automagically. +##### Now you need to update your Http Kernel to use the Localization Router. + +```php +// app/Http/Kernel.php + * - * @deprecated since v1.0.3 + * @property \Illuminate\Foundation\Application app + * @property \Arcanedev\Localization\Routing\Router router + * @property array middlewareGroups + * @property array routeMiddleware */ trait LocalizationKernelTrait { - // + /** + * Get the route dispatcher callback. + * + * @return \Closure + */ + protected function dispatchToRouter() + { + $this->replaceRouter(); + + return parent::dispatchToRouter(); + } + + /** + * Replace the illuminate router with the localization router. + */ + protected function replaceRouter() + { + $this->router = $this->app->make('router'); + + foreach ($this->middlewareGroups as $key => $middleware) { + $this->router->middlewareGroup($key, $middleware); + } + + foreach ($this->routeMiddleware as $key => $middleware) { + $this->router->aliasMiddleware($key, $middleware); + } + } }