|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* Provider |
|
5
|
|
|
*/ |
|
6
|
|
|
namespace Hokan22\LaravelTranslator\Provider; |
|
7
|
|
|
|
|
8
|
|
|
use Hokan22\LaravelTranslator\Commands\ClearUnusedTranslationsCommand; |
|
9
|
|
|
use Hokan22\LaravelTranslator\Commands\SearchTranslationsCommand; |
|
10
|
|
|
use Hokan22\LaravelTranslator\Commands\CacheTranslationCommand; |
|
11
|
|
|
use Hokan22\LaravelTranslator\Translator; |
|
12
|
|
|
use Illuminate\Support\ServiceProvider; |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* Class TranslatorProvider |
|
16
|
|
|
* |
|
17
|
|
|
* @package Hokan22\LaravelTranslator\Provider |
|
18
|
|
|
* @author Alexander Viertel <[email protected]> |
|
19
|
|
|
* @license http://opensource.org/licenses/MIT MIT |
|
20
|
|
|
*/ |
|
21
|
|
|
class TranslatorProvider extends ServiceProvider |
|
22
|
|
|
{ |
|
23
|
|
|
/** |
|
24
|
|
|
* Register any application services. |
|
25
|
|
|
*/ |
|
26
|
|
|
public function register() { |
|
27
|
|
|
$this->mergeConfigFrom(__DIR__ . '/../config/translator.php', 'translator'); |
|
28
|
|
|
|
|
29
|
|
|
$this->app->singleton('Translator', function() { |
|
30
|
|
|
return new Translator(); |
|
31
|
|
|
} |
|
32
|
|
|
); |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* Bootstrap any application services. |
|
37
|
|
|
*/ |
|
38
|
|
|
public function boot() { |
|
39
|
|
|
$this->publishes([ |
|
40
|
|
|
__DIR__ . '/../config/translator.php' => config_path('translator.php'), |
|
41
|
|
|
], |
|
42
|
|
|
'config' |
|
43
|
|
|
); |
|
44
|
|
|
|
|
45
|
|
|
$this->loadMigrationsFrom(__DIR__ . '/../migrations/'); |
|
46
|
|
|
$this->loadRoutesFrom(__DIR__ . '/../resources/routes.php'); |
|
47
|
|
|
$this->loadViewsFrom(__DIR__ . '/../resources/views', 'translator'); |
|
48
|
|
|
|
|
49
|
|
|
if ($this->app->runningInConsole()) { |
|
50
|
|
|
$this->commands([ |
|
51
|
|
|
CacheTranslationCommand::class, |
|
52
|
|
|
SearchTranslationsCommand::class, |
|
53
|
|
|
ClearUnusedTranslationsCommand::class, |
|
54
|
|
|
]); |
|
55
|
|
|
} |
|
56
|
|
|
} |
|
57
|
|
|
} |
|
58
|
|
|
|