Package Data | |
---|---|
Maintainer Username: | tabacitu |
Maintainer Contact: | tabacitu@backpackforlaravel.com (Cristian Tabacitu) |
Package Create Date: | 2016-03-11 |
Package Last Update: | 2024-08-28 |
Home Page: | http://backpackforlaravel.com |
Language: | PHP |
License: | proprietary |
Last Refreshed: | 2024-11-14 15:12:21 |
Package Statistics | |
---|---|
Total Downloads: | 704,233 |
Monthly Downloads: | 9,535 |
Daily Downloads: | 565 |
Total Stars: | 248 |
Total Watchers: | 18 |
Total Forks: | 78 |
Total Open Issues: | 9 |
An interface for the administrator to easily change application settings. Uses Laravel Backpack. On Laravel 5.2.
Security updates and breaking changes
Please subscribe to the Backpack Newsletter so you can find out about any security updates, breaking changes or major features. We send an email every 1-2 months.
In your terminal:
# install the package
composer require backpack/settings
# 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:base:add-sidebar-content "<li><a href='{{ url(config('backpack.base.route_prefix', 'admin') . '/setting') }}'><i class='fa fa-cog'></i> <span>Settings</span></a></li>"
# [optional] insert some example dummy data to the database
php artisan db:seed --class="Backpack\Settings\database\seeds\SettingsTableSeeder"
Add it to the menu or access it by its route: application/admin/setting
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')
Settings are stored in the database in the "settings" table. Its columns are:
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 https://laravel-backpack.readme.io/docs
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
.
Create the setting entry in your settings database. You can add the settings manually, or via Laravel seeders. The values inserted into the database should be look similar to below:
For Backpack show_powered_by
setting:
| Field | Value | | --- | --- | | key | show_powered_by | | name | Showed Powered By | | description | Whether to show the powered by Backpack on the bottom right corner or not. | | value | 1 | | field | {"name":"value","label":"Value","type":"checkbox"} | | active | 1 |
For Backpack Skin
setting:
| Field | Value | | --- | --- | | key | skin | | name | Skin | | description | Backpack admin panel skin settings. | | value | skin-purple | | field | {"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"} | | active | 1 |
Open up the app/Providers/AppServiceProvider
file, and add the below lines:
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
+ $this->overrideConfigValues();
}
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
+ protected function overrideConfigValues()
+ {
+ $config = [];
+ if (config('settings.skin'))
+ $config['backpack.base.skin'] = config('settings.skin');
+ if (config('settings.show_powered_by'))
+ $config['backpack.base.show_powered_by'] = config('settings.show_powered_by') == '1';
+ config($config);
+ }
}
See http://laravelbackpack.com
Please see CHANGELOG for more information what has changed recently.
$ composer test
Please see CONTRIBUTING for details.
If you need to modify how this works in a project:
routes/backpack/settings.php
file; the package will see that, and load your routes file, instead of the one in the package;If you discover any security related issues, please email hello@tabacitu.ro instead of using the issue tracker.
Please subscribe to the Backpack Newsletter so you can find out about any security updates, breaking changes or major features. We send an email every 1-2 months.
Backpack is free for non-commercial use and 49 EUR/project for commercial use. Please see License File and backpackforlaravel.com for more information.