Skip to content

Commit

Permalink
Added command to publish the configuration settings
Browse files Browse the repository at this point in the history
  • Loading branch information
tacio7brito committed Nov 12, 2020
1 parent 70256ce commit 8a38760
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions src/ZoopServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,14 @@ class ZoopServiceProvider extends ServiceProvider {
* @return void
*/
public function boot(){

$this->registerPublishing();
$this->mergeConfigFrom(__DIR__.'/resources/config/config.example.php', 'zoopconfig');
}

/**
* @return void
*/
public function register(){

$configFile = __DIR__.'/resources/config/config.php';

$this->mergeConfigFrom($configFile, 'zoopconfig');

$service = ZoopBase::getSingleton($this->app['config']->get('zoopconfig', []));

$this->app->singleton('ZoopBankAccounts', function () use ($service) {
Expand Down Expand Up @@ -87,6 +83,21 @@ public function register(){
});
}

/**
* Register the package's publishable resources.
*
* @return void
*/
private function registerPublishing()
{
if ($this->app->runningInConsole()) {
// Lumen lacks a config_path() helper, so we use base_path()
$this->publishes([
__DIR__.'/resources/config/config.example.php' => base_path('config/zoopconfig.php'),
], 'config');
}
}

/**
* @return array
*/
Expand Down

0 comments on commit 8a38760

Please sign in to comment.