PHP code example of danvaly / laravel-setting

1. Go to this page and download the library: Download danvaly/laravel-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/ */

    

danvaly / laravel-setting example snippets


Danvaly\Setting\Provider::class,

'Setting' => Danvaly\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 Danvaly\Setting\Contracts\Driver
{
	// ...
}

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