PHP code example of camc / lara-settings

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

    

camc / lara-settings example snippets


Camc\LaraSettings\LaraSetting::create(['key' => 'foo', 'value' => 'bar']);
// with a helper
lara_settings('foo'); // bar
// or with the facade
LaraSettings::get('foo'); // bar

LaraSettings::set('foo', 'baz');
lara_settings('foo'); // baz

Camc\LaraSettings\LaraSetting::create([
    'key' => 'foo', 
    'value' => ['bar' => 'baz']
]);
lara_settings('foo.bar') // baz

Camc\LaraSettings\Models\LaraSetting::whereKey('foo')->first()->delete();
lara_settings('foo', 'deleted'); // deleted

// a setting instance will be created if not yet defined
LaraSettings::set('foo', null);
lara_settings('foo', 'null value'); // "null value"

LaraSettings::fake(['a_fake_key' => 'a fake value']);

// database/seeders/settings/default.php


return [
    'foo' => ['bar' => 'baz']
];
 
// database/seeders

/**
* Only load settings if the file is present
*/
class LaraSettingsSeeder extends Seeder
{
    public function run()
    {
        $settingsFile =         }
    } 
}