File tree Expand file tree Collapse file tree 2 files changed +5
-21
lines changed Expand file tree Collapse file tree 2 files changed +5
-21
lines changed Original file line number Diff line number Diff line change 44
55use CodeZero \Localizer \Detectors \Detector ;
66use Illuminate \Support \Facades \App ;
7+ use Illuminate \Support \Facades \Config ;
78
89class Localizer
910{
@@ -35,11 +36,11 @@ class Localizer
3536 * @param \Illuminate\Support\Collection|array $detectors
3637 * @param \Illuminate\Support\Collection|array $stores
3738 */
38- public function __construct ($ locales , $ detectors , $ stores = [] )
39+ public function __construct ($ locales = null , $ detectors = null , $ stores = null )
3940 {
40- $ this ->locales = $ locales ;
41- $ this ->detectors = $ detectors ;
42- $ this ->stores = $ stores ;
41+ $ this ->locales = $ locales ?: Config:: get ( ' localizer.supported-locales ' ) ;
42+ $ this ->detectors = $ detectors ?: Config:: get ( ' localizer.detectors ' ) ;
43+ $ this ->stores = $ stores ?: Config:: get ( ' localizer.stores ' ) ;
4344 }
4445
4546 /**
Original file line number Diff line number Diff line change @@ -31,7 +31,6 @@ public function boot()
3131 public function register ()
3232 {
3333 $ this ->mergeConfig ();
34- $ this ->registerLocalizer ();
3534 }
3635
3736 /**
@@ -56,20 +55,4 @@ protected function mergeConfig()
5655 {
5756 $ this ->mergeConfigFrom (__DIR__ ."/../config/ {$ this ->name }.php " , $ this ->name );
5857 }
59-
60- /**
61- * Register Localizer.
62- *
63- * @return void
64- */
65- protected function registerLocalizer ()
66- {
67- $ this ->app ->bind (Localizer::class, function ($ app ) {
68- $ locales = $ app ['config ' ]->get ("{$ this ->name }.supported-locales " );
69- $ detectors = $ app ['config ' ]->get ("{$ this ->name }.detectors " );
70- $ stores = $ app ['config ' ]->get ("{$ this ->name }.stores " );
71-
72- return new Localizer ($ locales , $ detectors , $ stores );
73- });
74- }
7558}
You can’t perform that action at this time.
0 commit comments