Skip to content

Commit

Permalink
Registered File and Database Drivers to container bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
Luis Américo committed Dec 27, 2024
1 parent 1a341cf commit de510f4
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/TranslationServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
use JoeDixon\Translation\Console\Commands\ListMissingTranslationKeys;
use JoeDixon\Translation\Console\Commands\SynchroniseMissingTranslationKeys;
use JoeDixon\Translation\Console\Commands\SynchroniseTranslationsCommand;
use JoeDixon\Translation\Drivers\Database;
use JoeDixon\Translation\Drivers\File;
use JoeDixon\Translation\Drivers\Translation;

class TranslationServiceProvider extends ServiceProvider
Expand Down Expand Up @@ -181,5 +183,16 @@ private function registerContainerBindings()
$this->app->singleton(Translation::class, function ($app) {
return (new TranslationManager($app, $app['config']['translation'], $app->make(Scanner::class)))->resolve();
});

$this->app->singleton(File::class, function ($app) {
$scanner = $app->make(Scanner::class);
$languageFilesPath = $app->config['app']['locale'];

return new File(new Filesystem(), $app['path.lang'], $languageFilesPath, $scanner);
});

$this->app->singleton(Database::class, function ($app) {
return new Database($app->config['app']['locale'], $app->make(Scanner::class));
});
}
}

0 comments on commit de510f4

Please sign in to comment.