Building a site
Your own settings
Add tabs to Settings and read them in your templates.
Add tabs to Settings from a service provider. Fields are saved with the other settings and read with Setting::get().
use Aurora\Support\SettingsTabs;
use Filament\Schemas\Components\Tabs\Tab;
use Filament\Forms\Components\TextInput;
SettingsTabs::register(
'opening-hours',
fn (): Tab => Tab::make(__('Opening hours'))->schema([
TextInput::make('opening_hours')->label(__('Opening hours')),
]),
siteKeys: ['opening_hours'], // each site keeps its own value
page: 'website', // join Settings › Website (or null for a page of its own)
publicKeys: ['opening_hours'], // may be shown by the REST/GraphQL APIs
);
<p>{{ \Aurora\Models\Setting::get('opening_hours') }}</p>
This website adds the Header and Footer tabs under Settings › Website this way: the header button, the announcement bar, the footer note and social profiles.
Where tabs go v1.3.15
Put a tab where editors would look for it, on a page Settings already has, rather than adding items to its side menu:
- The website's own settings (its header, footer, opening hours): tabs on Website,
page: 'website', one per section. - A connection to another service (Mailchimp, Shopify, a booking system): a tab named after it on Integrations,
page: 'integrations'. - An area of its own with several tabs (a shop's shipping, payments and taxes): one page for them, added with
SettingsTabs::page(), which its tabs join by its key.
A tab registered without a page becomes an item of its own in the side menu.
SettingsTabs::page('shop', fn (): string => __('Shop'), 'phosphor-storefront');
SettingsTabs::register('shipping', fn (): Tab => Tab::make(__('Shipping'))->schema([...]), page: 'shop');
SettingsTabs::register('payments', fn (): Tab => Tab::make(__('Payments'))->schema([...]), page: 'shop');
Secrets v1.3.15
An API key or token editors enter goes in a SecretInput, with its key listed in secretKeys. It's stored encrypted and never sent to the browser: the field shows only its last four characters, and saving with the field empty keeps it. It's never public, even when listed in publicKeys. Read it with SettingSecrets::get(). A plain text field would send the value to the browser with the form.
use Aurora\Filament\Forms\Components\SecretInput;
use Aurora\Support\SettingSecrets;
SettingsTabs::register('mailchimp', fn (): Tab => Tab::make(__('Mailchimp'))->schema([
SecretInput::make('mailchimp_api_key')->label(__('API key')),
TextInput::make('mailchimp_audience')->label(__('Audience ID')),
]), page: 'integrations', secretKeys: ['mailchimp_api_key']);
// Where it's used:
$key = SettingSecrets::get('mailchimp_api_key');