Code Monkey home page Code Monkey logo

nova-settings-tool's Introduction

Laravel Nova tool to manage app settings

Latest Version on Packagist Total Downloads Build License: MIT

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 via Composer in any Laravel app using Nova:

composer require bakerkretzmar/nova-settings-tool

Nova Settings Tool v2 requires Nova 4—for older versions of Nova, use v1 of this package.

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,
        ];
    }

Usage

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 input
  • textarea: Multi-line text input
  • toggle: Boolean switch
  • code: CodeMirror text editor
  • number: Number input
  • select: Single-select dropdown

All strings in this package, and any you pass to it, can easily be translated using Laravel’s built-in localization features.

This tool also fires an event any time any settings are changed, with all the old and new settings attached.

Roadmap

The following features are planned or in development:

  • color setting type
  • date setting type
  • file setting type
  • setting validation

CHANGELOGCONTRIBUTINGLICENSE

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.