concept24 / nova-settings-tool
A Laravel Nova tool to manage application settings. Fork of bakerkretzmar/nova-settings-tool with Password field support.
Package info
github.com/Concept24-Development-SRL/nova-settings-tool
Language:Vue
pkg:composer/concept24/nova-settings-tool
Requires
- php: ^8.1
- laravel/nova: ^5.0
- spatie/valuestore: ^1.3
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
A Laravel Nova 5 tool to manage application settings, stored as JSON via spatie/valuestore.
Forked from bakerkretzmar/nova-settings-tool with additional field types.
What's different from the original
- Password field type -- values are stored as plain text and masked in the UI
- Nova 5 compatible -- implements the required
menu()method - Namespace --
Concept24\NovaSettingsTool
Requirements
- PHP >= 8.1
- Laravel Nova >= 5.0
- spatie/valuestore >= 1.3
Installation
composer require concept24/nova-settings-tool
Publish the config file:
php artisan vendor:publish --tag=nova-settings-tool
Register the tool in NovaServiceProvider:
use Concept24\NovaSettingsTool\SettingsTool; public function tools() { return [ new SettingsTool, ]; }
Configuration
Settings are defined in config/nova-settings-tool.php:
return [ 'path' => storage_path('app/settings.json'), 'sidebar-label' => 'Settings', 'title' => 'Settings', 'settings' => [ [ 'key' => 'site_name', 'label' => 'Site Name', ], [ 'key' => 'api_secret', 'label' => 'API Secret', 'type' => 'password', 'panel' => 'API', ], [ 'key' => 'maintenance', 'label' => 'Maintenance Mode', 'type' => 'toggle', 'help' => 'Enable maintenance mode on the frontend.', ], ], ];
Available field types
| Type | Description |
|---|---|
text |
Single-line text input (default) |
textarea |
Multi-line text input |
toggle |
Boolean toggle switch |
select |
Dropdown select (requires options key) |
number |
Numeric input |
code |
CodeMirror editor (optional language key) |
password |
Password input, stored as plain text, masked on read |
Setting options
| Key | Required | Description |
|---|---|---|
key |
Yes | Unique identifier, used as the storage key |
type |
No | Field type (default: text) |
label |
No | Display label (default: ucfirst of key) |
help |
No | Help text below the field (supports HTML) |
placeholder |
No | Input placeholder text |
panel |
No | Group settings into named panels |
options |
No | Key-value pairs for select type |
language |
No | CodeMirror language mode for code type |
Reading settings
use Spatie\Valuestore\Valuestore; $store = Valuestore::make(storage_path('app/settings.json')); $store->get('site_name'); $store->get('maintenance', false);
Events
A Concept24\NovaSettingsTool\Events\SettingsChanged event is fired every time settings are saved, with both the new and previous values.
License
MIT. Original work by Jacob Baker-Kretzmar.