PHP code example of ameax / filament-settings

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

    

ameax / filament-settings example snippets


return [
    'definitions' => [
        'shop' => [
            'label' => 'Shop Settings',
            'icon' => 'heroicon-o-shopping-bag',
            'order' => 1,
            'settings' => [
                'shop.name' => [
                    'label' => 'Shop Name',
                    'type' => 'string',
                    'validation' => ''validation' => '

use Ameax\FilamentSettings\Facades\Settings;

// Get a setting
$shopName = Settings::get('shop.name', 'Default Shop');

// Set a setting
Settings::set('shop.email', '[email protected]');

// Get all settings in a group
$shopSettings = Settings::getByGroup('shop');

// Clear cache after bulk updates
Settings::clearCache();

'settings' => [
    'api.key' => [
        'label' => 'API Key',
        'type' => 'encrypted',
        'validation' => '

'settings' => [
    'shop.name' => [
        'tab' => 'general',
        // ...
    ],
    'shop.tax_rate' => [
        'tab' => 'financial',
        // ...
    ],
    'shop.api_key' => [
        'tab' => 'advanced',
        // ...
    ],
],

'shop.currency' => [
    'label' => 'Currency',
    'type' => 'select',
    'options' => [
        'USD' => 'US Dollar',
        'EUR' => 'Euro',
        'GBP' => 'British Pound',
    ],
    'default' => 'USD',
],

namespace App\Models;

use Ameax\FilamentSettings\Models\Setting as BaseSettings;

class Setting extends BaseSettings
{
    public function getValueAttribute($value)
    {
        if ($this->type === 'custom_type') {
            return $this->processCustomType($value);
        }
        
        return parent::getValueAttribute($value);
    }
}
bash
php artisan vendor:publish --tag=filament-settings-config
bash
php artisan vendor:publish --tag=filament-settings-migrations
php artisan migrate
bash
php artisan vendor:publish --tag=filament-settings-views
javascript
module.exports = {
    content: [
        // ... your existing content paths
        './vendor/ameax/filament-settings/resources/views/**/*.blade.php',
    ],
    // ... rest of your config
}