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
@@ -57,7 +57,7 @@ class StaticPagesServiceProvider extends ServiceProvider
*/
protected function registerConfig()
{
$config = __DIR__ . DIRECTORY_SEPARATOR .'..'.DIRECTORY_SEPARATOR.'Config'.DIRECTORY_SEPARATOR.'config.php';
$config = __DIR__ . DIRECTORY_SEPARATOR .'../Config/config.php';
$this->publishes([$config => config_path('staticpages.php')]);
$this->mergeConfigFrom($config, 'staticpages');
}
@@ -69,13 +69,13 @@ class StaticPagesServiceProvider extends ServiceProvider
*/
public function registerViews()
{
$viewPath = base_path('resources'.DIRECTORY_SEPARATOR.'views'.DIRECTORY_SEPARATOR.'modules'.DIRECTORY_SEPARATOR.'staticpages');
$sourcePath = __DIR__ . DIRECTORY_SEPARATOR .'..'.DIRECTORY_SEPARATOR.'Resources'.DIRECTORY_SEPARATOR.'views';
$viewPath = base_path('resources/views/modules/staticpages');
$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.'staticpages';
return $path . '/modules/staticpages';
}, \Config::get('view.paths')), [$sourcePath]), 'staticpages');
/**
@@ -84,7 +84,7 @@ class StaticPagesServiceProvider extends ServiceProvider
$registrator = $this->app->make('registerTemplateDir');
try {
// setup some global variables
$registrator->setBaseDirectory('resources'.DIRECTORY_SEPARATOR.'views'.DIRECTORY_SEPARATOR.'modules'.DIRECTORY_SEPARATOR.'staticpages'.DIRECTORY_SEPARATOR.'visitor');
$registrator->setBaseDirectory('resources/views/modules/staticpages/visitor');
$registrator->setNamespace('staticpages');
$registrator->setModuleId(call_user_func([config('staticpages.handler'), 'getModuleId']));
@@ -102,6 +102,6 @@ class StaticPagesServiceProvider extends ServiceProvider
*/
public function registerTranslations()
{
$this->loadTranslationsFrom(__DIR__ . DIRECTORY_SEPARATOR. '..'.DIRECTORY_SEPARATOR.'Resources'.DIRECTORY_SEPARATOR.'lang', 'staticpages');
$this->loadTranslationsFrom(__DIR__ . '/../Resources/lang', 'staticpages');
}
}