PHP code example of codicastudio / setting

1. Go to this page and download the library: Download codicastudio/setting library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

codicastudio / setting example snippets


codicastudio\Setting\Provider::class,

'Setting' => codicastudio\Setting\Facade::class,

Setting::get('foo', 'default');
Setting::get('nested.element');
Setting::set('foo', 'bar');
Setting::forget('foo');
$settings = Setting::all();

setting('foo', 'default');
setting('nested.element');
setting(['foo' => 'bar']);
setting()->forget('foo');
$settings = setting()->all();

'override' => [
    "app.name" => "app_name",
    "app.env" => "app_env",
    "mail.driver" => "app_mail_driver",
    "mail.host" => "app_mail_host",
],

'encrypted_keys' => [
    "payment.key",
],

setting()->setExtraColumns(['user_id' => Auth::user()->id]);

setting()->setConstraint(function($query, $insert) {
	if ($insert) return;
	$query->where(/* ... */);
});

class MyDriver extends codicastudio\Setting\Contracts\Driver
{
	// ...
}

setting()->extend('mydriver', function($app) {
	return $app->make('MyDriver');
});
bash
php artisan vendor:publish --tag=setting
bash
php artisan migrate