@@ -13,138 +13,138 @@ |
||
13 | 13 | |
14 | 14 | class CoreServiceProvider extends ServiceProvider |
15 | 15 | { |
16 | - public const VIEWS_NAMESPACE = 'mdp'; |
|
17 | - |
|
18 | - public function register(): void |
|
19 | - { |
|
20 | - } |
|
21 | - |
|
22 | - public function boot(Factory $view): void |
|
23 | - { |
|
24 | - $this->registerPublishableConfigs(); |
|
25 | - $this->registerPublishableAssets(); |
|
26 | - $this->registerViews(); |
|
27 | - $this->registerViewComposers($view); |
|
28 | - $this->registerRoutes(); |
|
29 | - $this->registerLocales(); |
|
30 | - $this->registerComponents(); |
|
31 | - } |
|
32 | - |
|
33 | - /** |
|
34 | - * @return void |
|
35 | - */ |
|
36 | - public function registerComponents(): void |
|
37 | - { |
|
38 | - /** @var ComponentRegistrar $registrar */ |
|
39 | - $registrar = resolve(ComponentRegistrar::class); |
|
40 | - $registrar->register(); |
|
41 | - } |
|
42 | - |
|
43 | - public function registerPublishableConfigs(): void |
|
44 | - { |
|
45 | - $baseDir = __DIR__ . DIRECTORY_SEPARATOR . '..'; |
|
46 | - $configs = sprintf('%s%s%s', $baseDir, DIRECTORY_SEPARATOR, 'config'); |
|
47 | - $mdpCoreConfig = sprintf( |
|
48 | - '%s%s%s%s%s', |
|
49 | - $configs, |
|
50 | - DIRECTORY_SEPARATOR, |
|
51 | - 'mdp', |
|
52 | - DIRECTORY_SEPARATOR, |
|
53 | - 'core.php' |
|
54 | - ); |
|
55 | - |
|
56 | - $mdpMenuConfig = sprintf( |
|
57 | - '%s%s%s%s%s', |
|
58 | - $configs, |
|
59 | - DIRECTORY_SEPARATOR, |
|
60 | - 'mdp', |
|
61 | - DIRECTORY_SEPARATOR, |
|
62 | - 'menu.php' |
|
63 | - ); |
|
64 | - |
|
65 | - $this->publishes( |
|
66 | - [ |
|
67 | - $mdpCoreConfig => config_path( |
|
68 | - sprintf( |
|
69 | - '%s%s%s', |
|
70 | - 'mdp', |
|
71 | - DIRECTORY_SEPARATOR, |
|
72 | - 'core.php' |
|
73 | - ) |
|
74 | - ), |
|
75 | - $mdpMenuConfig => config_path( |
|
76 | - sprintf( |
|
77 | - '%s%s%s', |
|
78 | - 'mdp', |
|
79 | - DIRECTORY_SEPARATOR, |
|
80 | - 'menu.php' |
|
81 | - ) |
|
82 | - ), |
|
83 | - ] |
|
84 | - ); |
|
85 | - } |
|
86 | - |
|
87 | - public function registerPublishableAssets(): void |
|
88 | - { |
|
89 | - $packagePublic = __DIR__ . DIRECTORY_SEPARATOR . |
|
90 | - '..' . DIRECTORY_SEPARATOR . |
|
91 | - 'resources' . DIRECTORY_SEPARATOR . |
|
92 | - 'assets'; |
|
93 | - |
|
94 | - $this->publishes( |
|
95 | - [ |
|
96 | - $packagePublic => public_path('assets/mdp'), |
|
97 | - ] |
|
98 | - ); |
|
99 | - } |
|
100 | - |
|
101 | - public function registerViews(): void |
|
102 | - { |
|
103 | - $this->loadViewsFrom( |
|
104 | - __DIR__ . DIRECTORY_SEPARATOR . |
|
105 | - '..' . DIRECTORY_SEPARATOR . |
|
106 | - 'resources' . DIRECTORY_SEPARATOR . |
|
107 | - 'views', |
|
108 | - static::VIEWS_NAMESPACE |
|
109 | - ); |
|
110 | - } |
|
111 | - |
|
112 | - public function registerViewComposers(Factory $view): void |
|
113 | - { |
|
114 | - $view->composer('mdp::layouts.user.auth-v1', MdpViewComposer::class); |
|
115 | - $view->composer('mdp::layouts.main', MdpViewComposer::class); |
|
116 | - } |
|
117 | - |
|
118 | - public function registerRoutes(): void |
|
119 | - { |
|
120 | - if (Config::get('mdp.core.module.routes.enabled', false)) { |
|
121 | - $this->loadRoutesFrom( |
|
122 | - __DIR__ . DIRECTORY_SEPARATOR . |
|
123 | - '..' . DIRECTORY_SEPARATOR . |
|
124 | - 'routes' . DIRECTORY_SEPARATOR . |
|
125 | - 'mdp' . DIRECTORY_SEPARATOR . |
|
126 | - 'auth.php' |
|
127 | - ); |
|
128 | - |
|
129 | - $this->loadRoutesFrom( |
|
130 | - __DIR__ . DIRECTORY_SEPARATOR . |
|
131 | - '..' . DIRECTORY_SEPARATOR . |
|
132 | - 'routes' . DIRECTORY_SEPARATOR . |
|
133 | - 'mdp' . DIRECTORY_SEPARATOR . |
|
134 | - 'dashboard.php' |
|
135 | - ); |
|
136 | - } |
|
137 | - } |
|
138 | - |
|
139 | - public function registerLocales(): void |
|
140 | - { |
|
141 | - $baseDir = __DIR__ . DIRECTORY_SEPARATOR . '..'; |
|
142 | - $locales = sprintf('%s%s%s', $baseDir, DIRECTORY_SEPARATOR, 'lang'); |
|
143 | - |
|
144 | - $this->publishes([ |
|
145 | - sprintf('%s/%s/mdp.php', $locales, 'ua') => lang_path(sprintf('%s/mdp.php', 'ua')), |
|
146 | - sprintf('%s/%s/mdp.php', $locales, 'en') => lang_path(sprintf('%s/mdp.php', 'en')), |
|
147 | - sprintf('%s/%s/mdp.php', $locales, 'kz') => lang_path(sprintf('%s/mdp.php', 'kz')), |
|
148 | - ], 'locales'); |
|
149 | - } |
|
16 | + public const VIEWS_NAMESPACE = 'mdp'; |
|
17 | + |
|
18 | + public function register(): void |
|
19 | + { |
|
20 | + } |
|
21 | + |
|
22 | + public function boot(Factory $view): void |
|
23 | + { |
|
24 | + $this->registerPublishableConfigs(); |
|
25 | + $this->registerPublishableAssets(); |
|
26 | + $this->registerViews(); |
|
27 | + $this->registerViewComposers($view); |
|
28 | + $this->registerRoutes(); |
|
29 | + $this->registerLocales(); |
|
30 | + $this->registerComponents(); |
|
31 | + } |
|
32 | + |
|
33 | + /** |
|
34 | + * @return void |
|
35 | + */ |
|
36 | + public function registerComponents(): void |
|
37 | + { |
|
38 | + /** @var ComponentRegistrar $registrar */ |
|
39 | + $registrar = resolve(ComponentRegistrar::class); |
|
40 | + $registrar->register(); |
|
41 | + } |
|
42 | + |
|
43 | + public function registerPublishableConfigs(): void |
|
44 | + { |
|
45 | + $baseDir = __DIR__ . DIRECTORY_SEPARATOR . '..'; |
|
46 | + $configs = sprintf('%s%s%s', $baseDir, DIRECTORY_SEPARATOR, 'config'); |
|
47 | + $mdpCoreConfig = sprintf( |
|
48 | + '%s%s%s%s%s', |
|
49 | + $configs, |
|
50 | + DIRECTORY_SEPARATOR, |
|
51 | + 'mdp', |
|
52 | + DIRECTORY_SEPARATOR, |
|
53 | + 'core.php' |
|
54 | + ); |
|
55 | + |
|
56 | + $mdpMenuConfig = sprintf( |
|
57 | + '%s%s%s%s%s', |
|
58 | + $configs, |
|
59 | + DIRECTORY_SEPARATOR, |
|
60 | + 'mdp', |
|
61 | + DIRECTORY_SEPARATOR, |
|
62 | + 'menu.php' |
|
63 | + ); |
|
64 | + |
|
65 | + $this->publishes( |
|
66 | + [ |
|
67 | + $mdpCoreConfig => config_path( |
|
68 | + sprintf( |
|
69 | + '%s%s%s', |
|
70 | + 'mdp', |
|
71 | + DIRECTORY_SEPARATOR, |
|
72 | + 'core.php' |
|
73 | + ) |
|
74 | + ), |
|
75 | + $mdpMenuConfig => config_path( |
|
76 | + sprintf( |
|
77 | + '%s%s%s', |
|
78 | + 'mdp', |
|
79 | + DIRECTORY_SEPARATOR, |
|
80 | + 'menu.php' |
|
81 | + ) |
|
82 | + ), |
|
83 | + ] |
|
84 | + ); |
|
85 | + } |
|
86 | + |
|
87 | + public function registerPublishableAssets(): void |
|
88 | + { |
|
89 | + $packagePublic = __DIR__ . DIRECTORY_SEPARATOR . |
|
90 | + '..' . DIRECTORY_SEPARATOR . |
|
91 | + 'resources' . DIRECTORY_SEPARATOR . |
|
92 | + 'assets'; |
|
93 | + |
|
94 | + $this->publishes( |
|
95 | + [ |
|
96 | + $packagePublic => public_path('assets/mdp'), |
|
97 | + ] |
|
98 | + ); |
|
99 | + } |
|
100 | + |
|
101 | + public function registerViews(): void |
|
102 | + { |
|
103 | + $this->loadViewsFrom( |
|
104 | + __DIR__ . DIRECTORY_SEPARATOR . |
|
105 | + '..' . DIRECTORY_SEPARATOR . |
|
106 | + 'resources' . DIRECTORY_SEPARATOR . |
|
107 | + 'views', |
|
108 | + static::VIEWS_NAMESPACE |
|
109 | + ); |
|
110 | + } |
|
111 | + |
|
112 | + public function registerViewComposers(Factory $view): void |
|
113 | + { |
|
114 | + $view->composer('mdp::layouts.user.auth-v1', MdpViewComposer::class); |
|
115 | + $view->composer('mdp::layouts.main', MdpViewComposer::class); |
|
116 | + } |
|
117 | + |
|
118 | + public function registerRoutes(): void |
|
119 | + { |
|
120 | + if (Config::get('mdp.core.module.routes.enabled', false)) { |
|
121 | + $this->loadRoutesFrom( |
|
122 | + __DIR__ . DIRECTORY_SEPARATOR . |
|
123 | + '..' . DIRECTORY_SEPARATOR . |
|
124 | + 'routes' . DIRECTORY_SEPARATOR . |
|
125 | + 'mdp' . DIRECTORY_SEPARATOR . |
|
126 | + 'auth.php' |
|
127 | + ); |
|
128 | + |
|
129 | + $this->loadRoutesFrom( |
|
130 | + __DIR__ . DIRECTORY_SEPARATOR . |
|
131 | + '..' . DIRECTORY_SEPARATOR . |
|
132 | + 'routes' . DIRECTORY_SEPARATOR . |
|
133 | + 'mdp' . DIRECTORY_SEPARATOR . |
|
134 | + 'dashboard.php' |
|
135 | + ); |
|
136 | + } |
|
137 | + } |
|
138 | + |
|
139 | + public function registerLocales(): void |
|
140 | + { |
|
141 | + $baseDir = __DIR__ . DIRECTORY_SEPARATOR . '..'; |
|
142 | + $locales = sprintf('%s%s%s', $baseDir, DIRECTORY_SEPARATOR, 'lang'); |
|
143 | + |
|
144 | + $this->publishes([ |
|
145 | + sprintf('%s/%s/mdp.php', $locales, 'ua') => lang_path(sprintf('%s/mdp.php', 'ua')), |
|
146 | + sprintf('%s/%s/mdp.php', $locales, 'en') => lang_path(sprintf('%s/mdp.php', 'en')), |
|
147 | + sprintf('%s/%s/mdp.php', $locales, 'kz') => lang_path(sprintf('%s/mdp.php', 'kz')), |
|
148 | + ], 'locales'); |
|
149 | + } |
|
150 | 150 | } |