PHP code example of ferdiunal / nova-settings

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

    

ferdiunal / nova-settings example snippets


// in app/Providers/NovaServiceProvider.php

use Ferdiunal\NovaSettings\NovaSettings;

public function tools()
{
    return [
        new NovaSettings,
    ];
}

use function Ferdiunal\NovaSettings\settings;

// Accessing all settings
$allSettings = settings()->toArray();

// Accessing settings as a collection
$settingsCollection = settings()->toCollection(); // OR
$settingsCollection = settings("general")->toCollection();

// Converting settings to JSON
$jsonSettings = settings()->toJson(); // OR
$jsonSettings = settings("general")->toJson();

// Accessing a specific group of settings
$generalSettings = settings('general')->toArray();

// Accessing a specific setting within a group
$specificSetting = settings('general')->site_name;
$specificSetting = settings('general')->site_name();

// Accessing a nested setting directly
$nestedSetting = settings('general.site_name');