PHPackages                             tannhatcms/settings - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. tannhatcms/settings

ActiveLibrary

tannhatcms/settings
===================

Application settings interface for Laravel 5 using Backpack CRUD.

3.1.4(5mo ago)04proprietaryPHP

Since Jul 27Pushed 5mo agoCompare

[ Source](https://github.com/TanNhatCMS/Laravel-Backpack-Settings)[ Packagist](https://packagist.org/packages/tannhatcms/settings)[ Docs](https://github.com/laravel-backpack/settings)[ RSS](/packages/tannhatcms-settings/feed)WikiDiscussions dev Synced 1mo ago

READMEChangelog (1)Dependencies (3)Versions (73)Used By (0)

Backpack\\Settings
==================

[](#backpacksettings)

[![Latest Version on Packagist](https://camo.githubusercontent.com/a692f7782e50a40ac9a28000824c317be469a7ef16f0a076a832c2a0b16f13c6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6261636b7061636b2f73657474696e67732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/backpack/settings)[![Software License](https://camo.githubusercontent.com/5a202d5327ab4ae3bf5cc50fcfa3d2f0823d818a4f115a027d8176dcb996c4d4/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d6475616c2d626c75653f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/bffa678a4a06abdc0e1dc63d0548275aedca867b6a15142e4d84fc95da8c0fe4/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f636f6d2f6c61726176656c2d6261636b7061636b2f73657474696e6773)](https://travis-ci.org/laravel-backpack/settings)[![Coverage Status](https://camo.githubusercontent.com/7b097cab1a418f1a93d330258fd405f936db6b0d7c5b699a26feb0aacc76f2e8/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f6c61726176656c2d6261636b7061636b2f73657474696e67732e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/laravel-backpack/settings/code-structure)[![Quality Score](https://camo.githubusercontent.com/324927b3b6a7f180b869bdc8f5509f2bafb5b9fb1aacd83535fbcaa42bcb646c/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6c61726176656c2d6261636b7061636b2f73657474696e67732e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/laravel-backpack/settings)[![Style CI](https://camo.githubusercontent.com/357c591b8233b1292757b6c0f548f4efc89a4b2fd270ad97fa56c691f4fdcc30/68747470733a2f2f7374796c6563692e696f2f7265706f732f35333638333732392f736869656c64)](https://styleci.io/repos/53683729)[![Total Downloads](https://camo.githubusercontent.com/4f1ccd8bf9e4af062d2446ec8ca22de4086fcd2b93d8b9eb6718ebc07d500824/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6261636b7061636b2f73657474696e67732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/backpack/settings)

An interface for the administrator to easily change application settings. Uses Laravel Backpack. Works on Backpack v4, v5 and v6.

> ### Security updates and breaking changes
>
> [](#security-updates-and-breaking-changes)
>
> Please **[subscribe to the Backpack Newsletter](http://backpackforlaravel.com/newsletter)** so you can find out about any security updates, breaking changes or major features. We send an email every 1-2 months.

Install
-------

[](#install)

**Note:** The default table name is `settings`, if you need to change it please carefully read the comments in the instruction below.

In your terminal:

```
# install the package
composer require backpack/settings

# [optional] if you need to change table name or migration name, please do it now before proceding
php artisan vendor:publish --provider="Backpack\Settings\SettingsServiceProvider" --tag="config"
# then change the values you need in in `config/backpack/settings.php`

# publish & run the migration
php artisan vendor:publish --provider="Backpack\Settings\SettingsServiceProvider"
php artisan migrate

# [optional] add a menu item for it
# For Backpack v6
php artisan backpack:add-menu-content ""
# For Backpack v5 or v4
php artisan backpack:add-sidebar-content " Settings"

# [optional] insert some example dummy data to the database
php artisan db:seed --class="Backpack\Settings\database\seeds\SettingsTableSeeder"
```

Usage
-----

[](#usage)

### End user

[](#end-user)

Add it to the menu or access it by its route: **application/admin/setting**

### Programmer

[](#programmer)

Use it like you would any config value in a virtual settings.php file. Except the values are stored in the database and fetched on boot, instead of being stored in a file.

```
Setting::get('contact_email')
// or
Config::get('settings.contact_email')
```

### Add new settings

[](#add-new-settings)

Settings are stored in the database in the "settings" table. Its columns are:

- id (ex: 1)
- key (ex: contact\_email)
- name (ex: Contact form email address)
- description (ex: The email address that all emails go to.)
- value (ex: )
- field (Backpack CRUD field configuration in JSON format. The "name" of the field is **mandatory** to be "value") - see the field types and their configuration code on
- active (1 or 0)
- created\_at
- updated\_at

There is no interface available to add new settings. They are added by the developer directly in the database, since the Backpack CRUD field configuration is a bit complicated. See the field types and their configuration code on

### Override existing configurations

[](#override-existing-configurations)

You can use this addon to make various Laravel configurations adjustable through the settings GUI, including Backpack settings themself. For example, you can override the Backpack `show_powered_by` setting in `/config/backpack/ui.php`.

1. Create the setting entry in your settings database. You can add the settings manually, or via [Laravel seeders](https://laravel.com/docs/seeding). The values inserted into the database should be look similar to below:

    For Backpack `show_powered_by` setting:

    FieldValuekeyshow\_powered\_bynameShowed Powered BydescriptionWhether to show the powered by Backpack on the bottom right corner or not.value1field{"name":"value","label":"Value","type":"checkbox"}active1

**NOTE**: The `field` column should be a JSON string. The `name` key in the JSON string should be `value`. Using any other key will not work.

3. Open up the `app/Providers/AppServiceProvider` file, and add the below lines:

    ```
