PHP code example of jobmetric / laravel-setting

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

    

jobmetric / laravel-setting example snippets


public function domiStyles(): array
{
    return [['href' => '/build/settings/example.css']];
}

public function domiScripts(): array
{
    return [['src' => '/build/settings/example.js', 'type' => 'module', 'defer' => true]];
}

use JobMetric\Setting\Facades\Setting;

Setting::dispatchByForm('app_config', [
    'app_config_site_name' => 'My Site',
    'app_config_site_url'  => 'https://example.com',
]);

dispatchSetting('app_config', [
    'app_config_site_name' => 'My Site',
]);

use JobMetric\Setting\Facades\Setting;
use App\Settings\ConfigSetting;

Setting::dispatch(ConfigSetting::class, [
    'site_name' => 'My Site',
]);

use JobMetric\Setting\Facades\Setting;

$siteName = Setting::get('app_config_site_name');
$form = Setting::form('app_config');

use JobMetric\Setting\Facades\Setting;
use App\Settings\ConfigSetting;

$siteName = Setting::getFromClass(ConfigSetting::class, 'site_name');
$form = Setting::getFromClass(ConfigSetting::class, null);

use JobMetric\Setting\Facades\Setting;

Setting::forget('app_config');
bash
php artisan migrate
bash
php artisan setting:make ConfigSetting --application=app --title="Config" --description="Application configuration"
bash
php artisan setting:clear