Skip to content

Commit

Permalink
service provider configuration fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
dobrik committed Jun 11, 2019
1 parent 9e62d8c commit b09f40b
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,27 @@ class ServiceProvider extends \Illuminate\Support\ServiceProvider
{
public function register()
{
$this->mergeConfigFrom($this->getAliasesConfigPath(), 'easy_form/aliases');
$this->mergeConfigFrom($this->getFormsConfigPath(), 'easy_form/forms');
$this->mergeConfigFrom($this->getAliasesConfigPath(), 'easy_form.aliases');
$this->mergeConfigFrom($this->getFormsConfigPath(), 'easy_form.forms');

$this->app->singleton(Creator::class, function () {
$creator = new Creator(new Factory());
$configResolver = $this->app->make('config');
$creator = new Creator(new Factory($configResolver->get('easy_form.aliases')));
return $creator->setRequest($this->app->make(\Illuminate\Http\Request::class))
->registerFormConfig($this->app->make('config')->get('easy_form.forms'));
->registerFormConfig($configResolver->get('easy_form.forms'));
}
);
}

public function boot()
{
$this->loadViewsFrom(__DIR__ . '/resources/views', 'easy_form');
$this->loadViewsFrom($this->getViewsPath(), 'easy_form');

$this->publishes([
__DIR__ . '/resources/views' => resource_path('views/vendor/easy_form'),
]);

$this->publishes([
$this->getAliasesConfigPath() => config_path('easy_form/aliases.php'),
$this->getFormsConfigPath() => config_path('easy_form/forms.php')
$this->getFormsConfigPath() => config_path('easy_form/forms.php'),
$this->getViewsPath() => resource_path('views/vendor/easy_form'),
]);
}

Expand All @@ -43,4 +42,9 @@ private function getFormsConfigPath()
{
return __DIR__ . '/resources/config/forms.php';
}

private function getViewsPath(): string
{
return __DIR__ . '/resources/views';
}
}

0 comments on commit b09f40b

Please sign in to comment.