Skip to content

Commit

Permalink
Revert the Kernel's Trait
Browse files Browse the repository at this point in the history
  • Loading branch information
arcanedev-maroc committed Mar 22, 2017
1 parent bc0bfa9 commit 0ba0fe6
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 2 deletions.
17 changes: 17 additions & 0 deletions _docs/1-Installation-and-Setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
<?php namespace App\Http;

//...

class Kernel extends HttpKernel
{
// Localization Trait
use \Arcanedev\Localization\Traits\LocalizationKernelTrait;

// Your middleware(s) here
}
```

### Artisan commands

To publish the config &amp; view files, run this command:
Expand Down
33 changes: 31 additions & 2 deletions src/Traits/LocalizationKernelTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,38 @@
* @package Arcanedev\Localization\Traits
* @author ARCANEDEV <[email protected]>
*
* @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);
}
}
}

0 comments on commit 0ba0fe6

Please sign in to comment.