Skip to content

Commit d46cd7f

Browse files
authored
Merge pull request #98 from joedixon/fix-bindings
Move container bindings
2 parents 65a01b8 + 543a4e6 commit d46cd7f

File tree

2 files changed

+22
-21
lines changed

2 files changed

+22
-21
lines changed

src/TranslationBindingsServiceProvider.php

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace JoeDixon\Translation;
44

5-
use Illuminate\Filesystem\Filesystem;
65
use Illuminate\Translation\TranslationServiceProvider as ServiceProvider;
76
use Illuminate\Translation\Translator;
87
use JoeDixon\Translation\Drivers\Translation;
@@ -16,8 +15,6 @@ class TranslationBindingsServiceProvider extends ServiceProvider
1615
*/
1716
public function register()
1817
{
19-
$this->registerContainerBindings();
20-
2118
if ($this->app['config']['translation.driver'] === 'database') {
2219
$this->registerDatabaseTranslator();
2320
} else {
@@ -55,22 +52,4 @@ protected function registerDatabaseLoader()
5552
return new InterfaceDatabaseLoader($this->app->make(Translation::class));
5653
});
5754
}
58-
59-
/**
60-
* Register package bindings in the container.
61-
*
62-
* @return void
63-
*/
64-
private function registerContainerBindings()
65-
{
66-
$this->app->singleton(Scanner::class, function () {
67-
$config = $this->app['config']['translation'];
68-
69-
return new Scanner(new Filesystem, $config['scan_paths'], $config['translation_methods']);
70-
});
71-
72-
$this->app->singleton(Translation::class, function ($app) {
73-
return (new TranslationManager($app, $app['config']['translation'], $app->make(Scanner::class)))->resolve();
74-
});
75-
}
7655
}

src/TranslationServiceProvider.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22

33
namespace JoeDixon\Translation;
44

5+
use Illuminate\Filesystem\Filesystem;
56
use Illuminate\Support\ServiceProvider;
67
use JoeDixon\Translation\Console\Commands\AddLanguageCommand;
78
use JoeDixon\Translation\Console\Commands\AddTranslationKeyCommand;
89
use JoeDixon\Translation\Console\Commands\ListLanguagesCommand;
910
use JoeDixon\Translation\Console\Commands\ListMissingTranslationKeys;
1011
use JoeDixon\Translation\Console\Commands\SynchroniseMissingTranslationKeys;
1112
use JoeDixon\Translation\Console\Commands\SynchroniseTranslationsCommand;
13+
use JoeDixon\Translation\Drivers\Translation;
1214

1315
class TranslationServiceProvider extends ServiceProvider
1416
{
@@ -44,6 +46,8 @@ public function register()
4446
$this->mergeConfiguration();
4547

4648
$this->registerCommands();
49+
50+
$this->registerContainerBindings();
4751
}
4852

4953
/**
@@ -156,4 +160,22 @@ private function registerHelpers()
156160
{
157161
require __DIR__.'/../resources/helpers.php';
158162
}
163+
164+
/**
165+
* Register package bindings in the container.
166+
*
167+
* @return void
168+
*/
169+
private function registerContainerBindings()
170+
{
171+
$this->app->singleton(Scanner::class, function () {
172+
$config = $this->app['config']['translation'];
173+
174+
return new Scanner(new Filesystem, $config['scan_paths'], $config['translation_methods']);
175+
});
176+
177+
$this->app->singleton(Translation::class, function ($app) {
178+
return (new TranslationManager($app, $app['config']['translation'], $app->make(Scanner::class)))->resolve();
179+
});
180+
}
159181
}

0 commit comments

Comments
 (0)