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/ */
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();
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);
}
}