1
|
|
|
<?php namespace Arcanedev\Localization; |
2
|
|
|
|
3
|
|
|
use Arcanedev\Support\PackageServiceProvider; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* Class LocalizationServiceProvider |
7
|
|
|
* |
8
|
|
|
* @package Arcanedev\Localization |
9
|
|
|
* @author ARCANEDEV <[email protected]> |
10
|
|
|
*/ |
11
|
|
|
class LocalizationServiceProvider extends PackageServiceProvider |
12
|
|
|
{ |
13
|
|
|
/* ------------------------------------------------------------------------------------------------ |
14
|
|
|
| Properties |
15
|
|
|
| ------------------------------------------------------------------------------------------------ |
16
|
|
|
*/ |
17
|
|
|
/** |
18
|
|
|
* Package name. |
19
|
|
|
* |
20
|
|
|
* @var string |
21
|
|
|
*/ |
22
|
|
|
protected $package = 'localization'; |
23
|
|
|
|
24
|
|
|
/* ------------------------------------------------------------------------------------------------ |
25
|
|
|
| Main Functions |
26
|
|
|
| ------------------------------------------------------------------------------------------------ |
27
|
|
|
*/ |
28
|
|
|
/** |
29
|
|
|
* Register the service provider. |
30
|
|
|
*/ |
31
|
192 |
|
public function register() |
32
|
|
|
{ |
33
|
192 |
|
parent::register(); |
34
|
|
|
|
35
|
192 |
|
$this->registerConfig(); |
36
|
192 |
|
$this->registerProviders([ |
37
|
192 |
|
Providers\RoutingServiceProvider::class, |
38
|
64 |
|
Providers\UtilitiesServiceProvider::class, |
39
|
64 |
|
]); |
40
|
192 |
|
$this->registerLocalization(); |
41
|
192 |
|
$this->registerAliases(); |
42
|
192 |
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* Boot the package. |
46
|
|
|
*/ |
47
|
192 |
|
public function boot() |
48
|
|
|
{ |
49
|
192 |
|
parent::boot(); |
50
|
|
|
|
51
|
192 |
|
$this->publishConfig(); |
52
|
192 |
|
$this->publishViews(); |
53
|
192 |
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* Get the services provided by the provider. |
57
|
|
|
* |
58
|
|
|
* @return array |
59
|
|
|
*/ |
60
|
3 |
|
public function provides() |
61
|
|
|
{ |
62
|
|
|
return [ |
63
|
3 |
|
Contracts\Localization::class, |
64
|
1 |
|
'arcanedev.localization', |
65
|
1 |
|
]; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/* ------------------------------------------------------------------------------------------------ |
69
|
|
|
| Services Functions |
70
|
|
|
| ------------------------------------------------------------------------------------------------ |
71
|
|
|
*/ |
72
|
|
|
/** |
73
|
|
|
* Register Localization. |
74
|
|
|
*/ |
75
|
192 |
|
private function registerLocalization() |
76
|
|
|
{ |
77
|
192 |
|
$this->singleton(Contracts\Localization::class, Localization::class); |
78
|
192 |
|
$this->singleton('arcanedev.localization', Contracts\Localization::class); |
79
|
|
|
|
80
|
192 |
|
$this->alias( |
81
|
192 |
|
$this->config()->get('localization.facade', 'Localization'), |
82
|
128 |
|
Facades\Localization::class |
83
|
64 |
|
); |
84
|
192 |
|
} |
85
|
|
|
} |
86
|
|
|
|