|
10 | 10 | use CodeZero\Localizer\Localizer;
|
11 | 11 | use CodeZero\Localizer\LocalizerServiceProvider;
|
12 | 12 | use Illuminate\Support\ServiceProvider;
|
| 13 | +use Illuminate\Container\Container; |
13 | 14 |
|
14 | 15 | class LocalizedRoutesServiceProvider extends ServiceProvider
|
15 | 16 | {
|
@@ -104,19 +105,23 @@ protected function registerProviders()
|
104 | 105 | */
|
105 | 106 | protected function registerUrlGenerator()
|
106 | 107 | {
|
107 |
| - $this->app->singleton('url', function ($app) { |
| 108 | + $this->app->singleton('url', function () { |
| 109 | + $app = Container::getInstance(); |
| 110 | + |
108 | 111 | $routes = $app['router']->getRoutes();
|
109 | 112 |
|
110 | 113 | // The URL generator needs the route collection that exists on the router.
|
111 | 114 | // Keep in mind this is an object, so we're passing by references here
|
112 | 115 | // and all the registered routes will be available to the generator.
|
113 | 116 | $app->instance('routes', $routes);
|
114 | 117 |
|
115 |
| - $url = new UrlGenerator( |
116 |
| - $routes, $app->rebinding( |
| 118 | + $url = $app->make(UrlGenerator::class, [ |
| 119 | + 'routes' => $routes, |
| 120 | + 'request' => $app->rebinding( |
117 | 121 | 'request', $this->requestRebinder()
|
118 |
| - ), $app['config']['app.asset_url'] |
119 |
| - ); |
| 122 | + ), |
| 123 | + 'assetRoot' => $app['config']['app.asset_url'] |
| 124 | + ]); |
120 | 125 |
|
121 | 126 | // Next we will set a few service resolvers on the URL generator so it can
|
122 | 127 | // get the information it needs to function. This just provides some of
|
|
0 commit comments