GithubHelp home page GithubHelp logo

setting's Introduction

Laravel database settings

Still Maintained License [![Total Downloads] downloads-img]downloads-url

Store special settings, configs to database. No replace normal laravel config usage, only alternative for site settings.

Help support this project

If you'd like to support this and other our creations projects, donate via PayPal.

Support via PayPal


Installation

To add juy/setting to your Laravel application, follow these steps:

Add the following to your composer.json file:

"juy/setting": "dev-master"

Then, run composer update or composer install if you have not already installed packages.

Add the below line to the providers array in app/config/app.php configuration file (Need to add to the beginning/top, otherwise you may receive an error when you use the any config file).

'Juy\Setting\SettingServiceProvider',

Usage

// Get single value
Setting::get('mail_driver');

// Get single value with default value
Setting::get('mail_driver', 'default value');

// Set single value
Setting::set('mail_driver', 'smtp');

// Set multiple key, value
Setting::insert([$key => $value]);

// Set key, value from form post data
$post = Input::except('_token'); // except for token
Setting::insert($post);

Migration

php artisan migrate --package=juy/setting

Seed

There is no seed file, create one as you want.

<?php

use Juy\Setting\Model\Setting;

class SettingsTableSeeder extends \Seeder {

	public function run()
	{
		DB::table('settings')->truncate();

		Setting::insert([
			[
				'key'	=> 'mail_driver',
				'value'	=> 'smtp'
			],
			[
				'key'	=> 'mail_host',
				'value'	=> 'smtp.mailgun.org'
			],
		]);

	}
}

License

This project is open-sourced software licensed under the MIT license.

setting's People

Contributors

angelside avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.