REFACTORING: return / instaed of DIRECTORY_SEPARATOR in service providers
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
<?php namespace Modules\ContactForm\Providers;
|
<?php namespace Modules\ContactForm\Providers;
|
||||||
|
|
||||||
use App\Handlers\Registrators\TemplateRegistrator;
|
use App\Handlers\Registrators\TemplateRegistrator;
|
||||||
use Illuminate\Support\Facades\App;
|
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
use InvalidArgumentException;
|
use InvalidArgumentException;
|
||||||
|
|
||||||
@@ -44,10 +43,8 @@ class ContactFormServiceProvider extends ServiceProvider
|
|||||||
*/
|
*/
|
||||||
protected function registerConfig()
|
protected function registerConfig()
|
||||||
{
|
{
|
||||||
$this->publishes([
|
$this->publishes([__DIR__ . '/../Config/config.php' => config_path('contactform.php')]);
|
||||||
__DIR__ . DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'Config'.DIRECTORY_SEPARATOR.'config.php' => config_path('contactform.php'),
|
$this->mergeConfigFrom(__DIR__ . '/../Config/config.php', 'contactform');
|
||||||
]);
|
|
||||||
$this->mergeConfigFrom(__DIR__ . DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'Config'.DIRECTORY_SEPARATOR.'config.php', 'contactform');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -57,13 +54,13 @@ class ContactFormServiceProvider extends ServiceProvider
|
|||||||
*/
|
*/
|
||||||
public function registerViews()
|
public function registerViews()
|
||||||
{
|
{
|
||||||
$viewPath = base_path('resources'.DIRECTORY_SEPARATOR.'views'.DIRECTORY_SEPARATOR.'modules'.DIRECTORY_SEPARATOR.'contactform');
|
$viewPath = base_path('resources/views/modules/contactform');
|
||||||
$sourcePath = __DIR__ . DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'Resources'.DIRECTORY_SEPARATOR.'views';
|
$sourcePath = __DIR__ . '/../Resources/views';
|
||||||
|
|
||||||
$this->publishes([$sourcePath => $viewPath], 'module-views');
|
$this->publishes([$sourcePath => $viewPath], 'module-views');
|
||||||
|
|
||||||
$this->loadViewsFrom(array_merge(array_map(function ($path) {
|
$this->loadViewsFrom(array_merge(array_map(function ($path) {
|
||||||
return $path . DIRECTORY_SEPARATOR.'modules'.DIRECTORY_SEPARATOR.'contactform';
|
return $path . '/modules/contactform';
|
||||||
}, \Config::get('view.paths')), [$sourcePath]), 'contactform');
|
}, \Config::get('view.paths')), [$sourcePath]), 'contactform');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -90,7 +87,7 @@ class ContactFormServiceProvider extends ServiceProvider
|
|||||||
*/
|
*/
|
||||||
public function registerTranslations()
|
public function registerTranslations()
|
||||||
{
|
{
|
||||||
$this->loadTranslationsFrom(__DIR__ . DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'Resources'.DIRECTORY_SEPARATOR.'lang', 'contactform');
|
$this->loadTranslationsFrom(__DIR__ . '/../Resources/lang', 'contactform');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -42,9 +42,9 @@ class GalleryServiceProvider extends ServiceProvider
|
|||||||
protected function registerConfig()
|
protected function registerConfig()
|
||||||
{
|
{
|
||||||
$this->publishes([
|
$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()
|
public function registerViews()
|
||||||
{
|
{
|
||||||
$viewPath = base_path('resources' . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . 'gallery');
|
$viewPath = base_path('resources/views/modules/gallery');
|
||||||
$sourcePath = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'Resources' . DIRECTORY_SEPARATOR . 'views';
|
$sourcePath = __DIR__.'/../Resources/views';
|
||||||
|
|
||||||
$this->publishes([$sourcePath => $viewPath], 'module-views');
|
$this->publishes([$sourcePath => $viewPath], 'module-views');
|
||||||
|
|
||||||
$this->loadViewsFrom(array_merge(array_map(function ($path) {
|
$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');
|
}, \Config::get('view.paths')), [$sourcePath]), 'gallery');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -87,12 +87,12 @@ class GalleryServiceProvider extends ServiceProvider
|
|||||||
*/
|
*/
|
||||||
public function registerTranslations()
|
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)) {
|
if (is_dir($langPath)) {
|
||||||
$this->loadTranslationsFrom($langPath, 'gallery');
|
$this->loadTranslationsFrom($langPath, 'gallery');
|
||||||
} else {
|
} else {
|
||||||
$this->loadTranslationsFrom(__DIR__ . DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'Resources'.DIRECTORY_SEPARATOR.'lang', 'gallery');
|
$this->loadTranslationsFrom(__DIR__ . '/../Resources/lang', 'gallery');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ class StaticPagesServiceProvider extends ServiceProvider
|
|||||||
*/
|
*/
|
||||||
protected function registerConfig()
|
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->publishes([$config => config_path('staticpages.php')]);
|
||||||
$this->mergeConfigFrom($config, 'staticpages');
|
$this->mergeConfigFrom($config, 'staticpages');
|
||||||
}
|
}
|
||||||
@@ -69,13 +69,13 @@ class StaticPagesServiceProvider extends ServiceProvider
|
|||||||
*/
|
*/
|
||||||
public function registerViews()
|
public function registerViews()
|
||||||
{
|
{
|
||||||
$viewPath = base_path('resources'.DIRECTORY_SEPARATOR.'views'.DIRECTORY_SEPARATOR.'modules'.DIRECTORY_SEPARATOR.'staticpages');
|
$viewPath = base_path('resources/views/modules/staticpages');
|
||||||
$sourcePath = __DIR__ . DIRECTORY_SEPARATOR .'..'.DIRECTORY_SEPARATOR.'Resources'.DIRECTORY_SEPARATOR.'views';
|
$sourcePath = __DIR__ . '/../Resources/views';
|
||||||
|
|
||||||
$this->publishes([$sourcePath => $viewPath], 'module-views');
|
$this->publishes([$sourcePath => $viewPath], 'module-views');
|
||||||
|
|
||||||
$this->loadViewsFrom(array_merge(array_map(function ($path) {
|
$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');
|
}, \Config::get('view.paths')), [$sourcePath]), 'staticpages');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -84,7 +84,7 @@ class StaticPagesServiceProvider extends ServiceProvider
|
|||||||
$registrator = $this->app->make('registerTemplateDir');
|
$registrator = $this->app->make('registerTemplateDir');
|
||||||
try {
|
try {
|
||||||
// setup some global variables
|
// 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->setNamespace('staticpages');
|
||||||
$registrator->setModuleId(call_user_func([config('staticpages.handler'), 'getModuleId']));
|
$registrator->setModuleId(call_user_func([config('staticpages.handler'), 'getModuleId']));
|
||||||
|
|
||||||
@@ -102,6 +102,6 @@ class StaticPagesServiceProvider extends ServiceProvider
|
|||||||
*/
|
*/
|
||||||
public function registerTranslations()
|
public function registerTranslations()
|
||||||
{
|
{
|
||||||
$this->loadTranslationsFrom(__DIR__ . DIRECTORY_SEPARATOR. '..'.DIRECTORY_SEPARATOR.'Resources'.DIRECTORY_SEPARATOR.'lang', 'staticpages');
|
$this->loadTranslationsFrom(__DIR__ . '/../Resources/lang', 'staticpages');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user