PHP code example of hackeresq / laravel-settings

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

    

hackeresq / laravel-settings example snippets


Settings::set(['firm_name'=>'new']);

Settings::force()->set(['firm_name'=>'new']);

'fillable' => ['*']

Settings::get();

Settings::get('firm_name');

Settings::get(['firm_name','contact_types']);

Settings::has(['dark_theme']);

'encrypt' => [
        'twitter_client_id',
        'twitter_client_secret',
    ],

Settings::tenant('tenant_name')->set(['firm_name'=>'foo bar']);

// returns true (i.e. successfully set `firm name`)


Settings::tenant('tenant_name')->get('firm_name');

// returns 'foo bar'


Settings::tenant('tenant_name')->has('firm_name');

// returns true


// settings.php

'cast' => [
  'array_of_values' => 'json' 
]

Settings::set(['array_of_values' => ['one', 'two', 'three']]);

return Settings::get('array_of_values');

// returns a PHP array: ['one', 'two', 'three']

'cache' => false

'hidden' => [
        'twitter_client_secret',
        'super_secret_password',
    ],

'hidden' => ['*'],

'table' => 'user_options_table',
bash
php artisan vendor:publish --provider="HackerESQ\Settings\SettingsServiceProvider" --tag=migrations && php artisan vendor:publish --provider="HackerESQ\Settings\SettingsServiceProvider" --tag=config && php artisan migrate