Skip to content

austinheap/nova-settings-tool

 
 

Repository files navigation

A Laravel Nova tool to manage app settings

Latest Version on Packagist Total Downloads License: MIT StyleCI

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.

Settings Tool screenshot

Installation

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 Bakerkretzmar\SettingsTool\SettingsTool;

// ...

public function tools()
{
    return [
        new SettingsTool,
    ];
}

Usage

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 has a name and contains some settings. 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.

There are three available setting types:

Type... ...displays
toggle Boolean
text Single-line text input
textarea Multi-line text input

All the strings hard-coded in this package (like in the "Save" button), as well as any you pass to it (like the name of any of your settings), can easily be translated using Laravel's built-in localization features.

Testing

composer test

I'm new to testing and would welcome testing-related PRs.

Changelog

Please see the CHANGELOG for information about what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email jacobtbk@gmail.com instead of using the issue tracker.

License

This package is licensed under the MIT License (MIT). Please see the LICENSE for details.

About

A Laravel Nova tool to view and edit application settings.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 49.4%
  • Vue 41.6%
  • HTML 7.2%
  • JavaScript 1.8%