PHPackages                             haiau009/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. haiau009/settings

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

haiau009/settings
=================

Application settings interface for Laravel 5 using Backpack CRUD.

1.0.0(2y ago)07291proprietaryPHP

Since Dec 19Pushed 2y ago1 watchersCompare

[ Source](https://github.com/HaiAu009/Settings)[ Packagist](https://packagist.org/packages/haiau009/settings)[ Docs](https://github.com/laravel-backpack/settings)[ RSS](/packages/haiau009-settings/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (4)Versions (2)Used By (1)

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/6d9660f35932bb5ad9ba1b5545009c193f2f81b9360e22e82677178c82b0020f/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6c61726176656c2d6261636b7061636b2f73657474696e67732f6d61737465722e7376673f7374796c653d666c61742d737175617265)](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 Laravel 5.2 to Laravel 8.

> ### 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 to the sidebar_content file
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. )
- 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` or the `skin` setting in `/config/Backpack/base.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"}active1For Backpack `Skin` setting:

    FieldValuekeyskinnameSkindescriptionBackpack admin panel skin settings.valueskin-purplefield{"name":"value","label":"Value","type":"select2\_from\_array","options":{"skin-black":"Black","skin-blue":"Blue", "skin-purple":"Purple","skin-red":"Red","skin-yellow":"Yellow","skin-green":"Green","skin-blue-light":"Blue light", "skin-black-light":"Black light","skin-purple-light":"Purple light","skin-green-light":"Green light","skin-red-light":"Red light", "skin-yellow-light":"Yellow light"},"allows\_null":false,"default":"skin-purple"}active1
2. Open up the `app/Providers/AppServiceProvider` file, and add the below lines:

    ```
