REFACTORING: return / instaed of DIRECTORY_SEPARATOR in service providers

This commit is contained in:
Michal Kváček
2016-04-04 21:48:05 +02:00
parent 439b048590
commit 1a33c74c6d
3 changed files with 19 additions and 22 deletions
@@ -42,9 +42,9 @@ class GalleryServiceProvider extends ServiceProvider
protected function registerConfig()
{
$this->publishes([
__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'Config' . DIRECTORY_SEPARATOR . 'config.php' => config_path('gallery.php'),
__DIR__.'/../Config/config.php' => config_path('gallery.php'),
]);
$this->mergeConfigFrom(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'Config' . DIRECTORY_SEPARATOR . 'config.php', 'gallery');
$this->mergeConfigFrom(__DIR__.'/../Config/config.php', 'gallery');
}
/**
@@ -54,13 +54,13 @@ class GalleryServiceProvider extends ServiceProvider
*/
public function registerViews()
{
$viewPath = base_path('resources' . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . 'gallery');
$sourcePath = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'Resources' . DIRECTORY_SEPARATOR . 'views';
$viewPath = base_path('resources/views/modules/gallery');
$sourcePath = __DIR__.'/../Resources/views';
$this->publishes([$sourcePath => $viewPath], 'module-views');
$this->loadViewsFrom(array_merge(array_map(function ($path) {
return $path . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . 'gallery';
return $path.'/modules/gallery';
}, \Config::get('view.paths')), [$sourcePath]), 'gallery');
/**
@@ -87,12 +87,12 @@ class GalleryServiceProvider extends ServiceProvider
*/
public function registerTranslations()
{
$langPath = base_path('resources' . DIRECTORY_SEPARATOR . 'lang' . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . 'gallery');
$langPath = base_path('resources/lang/modules/gallery');
if (is_dir($langPath)) {
$this->loadTranslationsFrom($langPath, 'gallery');
} else {
$this->loadTranslationsFrom(__DIR__ . DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'Resources'.DIRECTORY_SEPARATOR.'lang', 'gallery');
$this->loadTranslationsFrom(__DIR__ . '/../Resources/lang', 'gallery');
}
}