Adding setting not working



  • Hello.
    I've created new module, and wanted to add two settings for it.
    According to instruction:
    Adding settings for you module is very easy. All you need to do is add a settings.php configuration file in YourModule/config/settings.php, and return an array of settings you want.

    So i added this file with content

    return [
    'manager-email' => [
    'description' => 'Manager email',
    'view' => 'text',
    'default' => '',
    ],
    'admin-email' => [
    'description' => 'Admin email',
    'view' => 'text',
    'default' => '',
    ],
    ];

    This added fields are not appearing in Settings of backend. As i see it was created with that intention, you just should add fields and you can set them in backend and use in all the application.
    What am I missing?



  • Did you publish the settings file to your config folder?



  • No, I didn't published anything.
    How to make it?



  • In your Models ServiceProvider you need to extend the boot() method like here for my Band Module:

    public function boot()
    {
        $this->publishConfig('band', 'permissions');
        $this->publishConfig('band', 'settings');
    }
    

    Then you should do

    php artisan module:publish-config

    in your shell, which should copy the config files to your config folder.

    After that it should work.

    Please let me know.



  • @kay899 Yes, it worked!!! Thank you!
    Maybe this answer of yours should be added to documentation somehow, it would help other people also.



  • I thought the same. Perhaps you could contribute that?



  • Well, as I saw some asgard developers sometimes visit forum, it is possible that they will see that topic also. Don't know other options to make it happend.)
    And once again thank you so much for your help.


  • admin

    Feel free to send a PR with this new information :)


Log in to reply
 

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