PHP code example of visual-ideas / laravel-site-settings

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

    

visual-ideas / laravel-site-settings example snippets


return [
    'cache_key' => env('LSS_CACHE_KEY','laravel_site_settings_data'),
   
    // Set to true if you're using Filament (https://filamentphp.com/)
    'filament' => false,
];

function settings($key = null, $default = null)
{
    if (is_null($key)) {
        return app('Settings')->all();
    }

    if (is_array($key)) {
        return app('Settings')->set($key);
    }

    return app('Settings')->get($key, $default);
}

@settings('group.setting')

@config('settings.group.setting')

settings(['group.setting' => 'Value']);
settings(['setting' => 'Value']);

MenuGroup::make('Settings', [
    MenuItem::make(
        'Setting groups',
        new \VI\LaravelSiteSettings\MoonShine\Resources\SettingGroupResource(),
        'heroicons.outline.wrench-screwdriver'
    ),
    MenuItem::make(
        'Settings',
        new \VI\LaravelSiteSettings\MoonShine\Resources\SettingResource(),
        'heroicons.outline.wrench'
    ),
], 'heroicons.outline.cog-8-tooth'),

    //...   
    // Set to true if you're using Filament (https://filamentphp.com/)
    'filament' => true,
    //...

settings([
    ['group.setting1' => 'Value1'],
    ['group.setting2' => 'Value2'],
    ['group.setting3' => 'Value3'],
    ['setting1' => 'Value4'],
    ['setting2' => 'Value5'],
    ['setting3' => 'Value6'],
    ['setting4' => 'Value7'],
    ['setting5' => 'Value8']
]);
bash
php artisan migrate
bash
php artisan vendor:publish --provider="VI\LaravelSiteSettings\LaravelSiteSettingsProvider" --tag="config"
bash
php artisan iseed setting_groups,settings