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
@@ -1,7 +1,6 @@
<?php namespace Modules\ContactForm\Providers;
use App\Handlers\Registrators\TemplateRegistrator;
use Illuminate\Support\Facades\App;
use Illuminate\Support\ServiceProvider;
use InvalidArgumentException;
@@ -44,10 +43,8 @@ class ContactFormServiceProvider extends ServiceProvider
*/
protected function registerConfig()
{
$this->publishes([
__DIR__ . DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'Config'.DIRECTORY_SEPARATOR.'config.php' => config_path('contactform.php'),
]);
$this->mergeConfigFrom(__DIR__ . DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'Config'.DIRECTORY_SEPARATOR.'config.php', 'contactform');
$this->publishes([__DIR__ . '/../Config/config.php' => config_path('contactform.php')]);
$this->mergeConfigFrom(__DIR__ . '/../Config/config.php', 'contactform');
}
/**
@@ -57,13 +54,13 @@ class ContactFormServiceProvider extends ServiceProvider
*/
public function registerViews()
{
$viewPath = base_path('resources'.DIRECTORY_SEPARATOR.'views'.DIRECTORY_SEPARATOR.'modules'.DIRECTORY_SEPARATOR.'contactform');
$sourcePath = __DIR__ . DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'Resources'.DIRECTORY_SEPARATOR.'views';
$viewPath = base_path('resources/views/modules/contactform');
$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.'contactform';
return $path . '/modules/contactform';
}, \Config::get('view.paths')), [$sourcePath]), 'contactform');
/**
@@ -90,7 +87,7 @@ class ContactFormServiceProvider extends ServiceProvider
*/
public function registerTranslations()
{
$this->loadTranslationsFrom(__DIR__ . DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'Resources'.DIRECTORY_SEPARATOR.'lang', 'contactform');
$this->loadTranslationsFrom(__DIR__ . '/../Resources/lang', 'contactform');
}
/**