Package Data | |
---|---|
Maintainer Username: | bakerkretzmar |
Maintainer Contact: | jacobtbk@gmail.com (Jacob Baker-Kretzmar) |
Package Create Date: | 2019-01-11 |
Package Last Update: | 2024-02-22 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-12-17 03:08:29 |
Package Statistics | |
---|---|
Total Downloads: | 171,918 |
Monthly Downloads: | 2,380 |
Daily Downloads: | 101 |
Total Stars: | 166 |
Total Watchers: | 4 |
Total Forks: | 32 |
Total Open Issues: | 1 |
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 via Composer in any Laravel app using Nova:
composer require bakerkretzmar/nova-settings-tool
Publish the default configuration file to config/nova-settings-tool.php
:
php artisan vendor:publish --tag="nova-settings-tool"
Register the tool with Nova in the tools
method of your NovaServiceProvider
:
// in app/Providers/NovaServiceProvider.php
use Bakerkretzmar\NovaSettingsTool\SettingsTool;
// ...
public function tools()
{
return [
new SettingsTool,
];
}
Settings are declared in a nova-settings-tool.php
config file. This file specifies where settings are stored, what the tool’s title is in Nova’s sidebar, the layout of the settings page, and metadata about the settings themselves.
A default config file with some helpful examples is included as a starting point:
Each item in the settings
array is rendered as an input with a label and help text, similar to one of Nova’s fields. Settings can also be grouped into panels, to separate them visually.
The settings’ actual values are stored as JSON at the location specified in the config file—storage/app/settings.json
by default.
There are currently six available setting types:
text
: Single-line text inputtextarea
: Multi-line text inputtoggle
: Boolean switchcode
: CodeMirror text editornumber
: Number inputselect
: Single-select dropdownAll strings in this package, and any you pass to it, can easily be translated using Laravel’s built-in localization features.
The following features are planned or in development:
color
setting typedate
setting typefile
setting type