Publish custom module config files

  • Hi, I'm wondering how can I publish configuration files of a module created by scaffolding.

    I can't find any asgard.xxxx.config nor asgard.xxxx.permissions file created on root config folder.

    I've browsed the PingPong Sky documentation as well as Asgard CMS' but I can't find any php artisan module:xxxxx command to do so.

    Any directions?

    UPDATE: Found the way to do so by running the command:

    php artisan vendor:publish --provider="Modules\YourModule\Providers\YourModuleServiceProvider"

    And having into the provider boot() method the lines:

    $this->mergeConfigFrom(__DIR__ . '/../Config/config.php', 'asgard.yourmodule.config');
    $this->publishes([__DIR__ . '/../Config/config.php' => config_path('asgard.yourmodule.config' . '.php'), ], 'config');

    The only thing I'm missing is how to publish the asgard.yourmodule.permissions file (and where to declare it) :confused:

  • Global Moderator


    Just like you would do for config.php same for permissions.

    $this->mergeConfigFrom(__DIR__ . '/../Config/permissions.php', 'asgard.yourmodule.permissions');
    $this->publishes([__DIR__ . '/../Config/permissions.php' => config_path('asgard.yourmodule.permissions' . '.php'), ], 'permissions');

    php artisan vendor:publish --provider="Modules\YourModule\Providers\YourModuleServiceProvider" --tag="permissions"

  • All right, I was wondering it would be the same way, but as I've not seen the publishing on the core modules' code, I thought it was another way...

    Thanks @armababy !

Looks like your connection to AsgardCms was lost, please wait while we try to reconnect.