dev-master
9999999-dev
The Requires
- php >=5.4.0
- howlowck/html-builder *
- illuminate/support ~4
by Hao Luo
This package is created to easily change application-level settings that Administator can change., (*1)
"howlowck/settings-l4": "dev-master",
in your application composer.jsoncomposer update
'Howlowck\SettingsL4\SettingsL4ServiceProvider',
in app/config/app.php
'Setting' => 'Howlowck\SettingsL4\Facade\Setting'
in app/config/app.php
php artisan config:publish howlowck/settings-l4
In app/config/howlowck/settings-l4/config.php
, (*2)
table
--- table name, (*3)
db
--- whether to use db or redis, (*4)
user_column
--- the column name of user if you want to capture who changed the setting (not implemented), (*5)
controller
--- the controller name, (*6)
route_path
--- the route path to get to the settings resource controller, (*7)
route_before
--- the filter string for before running to the route, (*8)
route_after
--- the filter string after running to the route, (*9)
form_types
--- the associated array for the input types are is associated with the database data fields, * is default, (*10)
The Settings Package allows you to interact your settings in various ways., (*11)
Setting::get($settingName)
returns the value of the setting with that name
Setting::set($settingName, $settingValue)
sets the value to the setting name
Setting::all()
returns all the settings in an array, (*12)
Setting::route()
in your routes.php this will set up a route group for your settings controller. You can change the path and before/after filters in the config file.vendors/howlowck/settings-l4/src/controllers/SettingsController.php
to your controllers folder. Feel free to change the name of the controller to anything you like, you just have to change the 'controller' configuration item in the config file.php artisan asset:publish howlowck/settings-l4
path/to/settings/settingName/edit
you will see a UI that allows you to edit the value.The available paths are only path/to/settings
and path/to/settings/settingName
, (*13)
If you prefer to make your own views you can use the following
Setting::getTitle($settingName)
--- gives you the title of the setting, (*14)
Setting::getField($settingName)
--- gives you the field of the setting, (*15)
Settings::getUpdateUrl($settingName)
--- gives you the correct url to put in your form action property, (*16)