Store and edit simple app-wide settings right in Nova. Settings are stored as JSON using spatie/valuestore
, making them really easy to pull in and use everywhere else in your app.
Install the package in any Laravel app that uses Nova via composer:
composer require bakerkretzmar/nova-settings-tool
Publish the included default configuration file to config/settings.php
(optional, see below):
php artisan vendor:publish --tag="settings-tool"
Register the tool with Nova in the tools
method of your NovaServiceProvider
:
// in app/Providers/NovaServiceProvider.php
use Ajmariduena\SettingsTool\SettingsTool;
// ...
public function tools()
{
return [
new SettingsTool,
];
}
Settings can be declared using a settings.php
file in your app's config
folder. This file lets you specify where your settings are stored, what the tool's title is in Nova's sidebar, the layout of the settings page, and information about the settings themselves.
This package includes a default config file that you can publish and use as a starting point:
php artisan vendor:publish --tag="settings-tool"
The default config contains examples that should be pretty self-explanatory, and lots of comments in case they aren't.
Each item in the panels
array is rendered as its own 'group' of settings, like a panel on one of Nova's detail views. Each panel can have a name and contain settings, which are rendered as toggle switches or text inputs. Each setting can optionally have a description and a link to more information (e.g. docs). Only the setting's key and value are actually stored in your settings.json
file.
composer test
I'm new to testing and would welcome testing-related PRs.
Please see the CHANGELOG for information about what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
This package is licensed under the MIT License (MIT). Please see the LICENSE for details.