2017 © Pedro Peláez
 

library settings-l4

image

howlowck/settings-l4

  • Wednesday, January 8, 2014
  • by howlowck
  • Repository
  • 1 Watchers
  • 0 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Settings Package Laravel

This package is created to easily change application-level settings that Administator can change., (*1)

Setup

  1. Include "howlowck/settings-l4": "dev-master", in your application composer.json
  2. run composer update
  3. Add service provider by adding 'Howlowck\SettingsL4\SettingsL4ServiceProvider', in app/config/app.php
  4. Add Setting Facade by adding 'Setting' => 'Howlowck\SettingsL4\Facade\Setting' in app/config/app.php
  5. Run php artisan config:publish howlowck/settings-l4
  6. generate your own migration with the table name 'settings'. (if you want to use a table named other than 'settings', please change the 'table' config item in the configuration file)
  7. generate a seed for one row of data. (it's required for settings to work properly)

Configuration

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)

To Use

The Settings Package allows you to interact your settings in various ways., (*11)

Basic Usage

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)

Built-in views and Routes

  1. Include 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.
  2. Copy the Settings Controller from 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.
  3. Run php artisan asset:publish howlowck/settings-l4
  4. Now when you go to any path with 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)

Making your own views

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)

The Versions

08/01 2014

dev-master

9999999-dev

  Sources   Download

The Requires