GithubHelp home page GithubHelp logo

system-settings-db's Introduction

system-settings-db

Very simple package for storing settings for your Laravel project in the database.

Installation

Install the package with composer:

composer require core45/system-settings-db

Publish the package files:

php artisan vendor:publish --provider="Core45\SystemSettingsDb\SystemSettingsDbServiceProvider"

Migrate the database:

php artisan migrate

Usage

After migrating the new table system_settings will be created in the database. The package doesn't provide a UI for managing the settings. You have to add/modify/delete the records on your own. The important columns are:

  • key: the key of the setting
  • value: the value of the setting

The other columns are for your convenience. You can also add your own columns to the table if you like.

Setting a value

In the database you can set a value for a key. The key is a string and the value can be a string, integer or boolean.

To access the value of a key you can use the config() helper function.

config('system-settings.some-key');

So for example in your blade template you can use your contact email you previously stored in the settings table:

My email is: <a href="mailto:{{ config('system-settings.email') }}">{{ config('system-settings.email') }}</a>

Cache

The package uses the Laravel cache so if you'd like to see the changes immediately clean the Laravel cache. Default TTL of the cache is 60 seconds. You can change this setting in the config file.

License

MIT

system-settings-db's People

Contributors

core45 avatar

Stargazers

 avatar

Watchers

 avatar

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.