artkonekt / appshell

AppShell is an Laravel Application boilerplate with UI, ACL, Users & Customers
https://konekt.dev/appshell
MIT License
80 stars 10 forks source link

Add custom settings #13

Closed K4q4m3 closed 5 years ago

K4q4m3 commented 5 years ago

Is it possible to add extra settings fields from config file?

https://github.com/artkonekt/appshell/blob/9cf5222a05b183432fa9c2bd7a3905eb177e8cd9/src/Providers/ModuleServiceProvider.php#L279-L282

fulopattila122 commented 5 years ago

Not from config file at the moment, but this is how you do it within your app's AppServiceProvider::boot() method:

//use Konekt\Gears\Defaults\SimpleSetting;

// Register the setting:
$this->app->get('gears.settings_registry')
        ->add(new SimpleSetting('app.worklogs.hours_per_day', 6));

// Add the setting to the AppShell UI
$this->app->get('appshell.settings_tree_builder')
        ->addRootNode('app', 'Application', 110) // the id/label of the tab
        ->addChildNode('app', 'app_worklogs', 'Worklogs') // the id/label of the group within the tab
        ->addSettingItem('app_worklogs', ['text', ['label' => 'Hours Per Day']], 'app.worklogs.hours_per_day'); // The setting field itself

image

The Settings part is built with the gears library, for in-depth details it may worth to take a look at: https://artkonekt.github.io/gears/

Also feel free to send a follow up here.

fulopattila122 commented 5 years ago

Please reopen if it doesn't work as expected.