PHP code example of markofly / laravel-settings

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

    

markofly / laravel-settings example snippets


'providers' => [
  ...
  Markofly\Settings\SettingsServiceProvider::class,
],

'aliases' => [
  ...
  'Settings' => \Markofly\Settings\Facades\Settings::class,
],



return [
    ...
    'fields' => [
            'site_name' => [
                'default' => 'Laravel 5',
            ],
            ...
        ],
];


Settings::get('site_name');
Settings::get('site_name', 'Default value');


Settings::save('site_name', 'Laravel 5');


Settings::getAllSettings();

 [
  'site_name' => [
    'value' => null             // Value stored in database
    "default' => 'Laravel 5'    // Default value in config
    'group' => [                // group settings in config
      'label' => 'Site settings'
      'slug' => 'site-settings'
    ]
  ]
]
bash
$ php artisan vendor:publish --provider="Markofly\Settings\SettingsServiceProvider"
bash
$ php artisan migrate