1. Go to this page and download the library: Download outerweb/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/ */
outerweb / filament-settings example snippets
use Outerweb\FilamentSettings\SettingsPlugin;
public function panel(Panel $panel): Panel
{
return $panel
// ...
->plugins([
// ...
SettingsPlugin::make()
->pages([
// Add your settings pages here
]),
]);
}
namespace App\Filament\Pages;
use Outerweb\FilamentSettings\Pages\Settings;
class MySettings extends Settings
{
public function form(Schema $schema): Schema
{
return $schema
->components([
Tabs::make()
->columnSpanFull()
->tabs([
Tab::make('General')
->schema([
TextInput::make('general.brand_name')
->
use Outerweb\FilamentSettings\SettingsPlugin;
public function panel(Panel $panel): Panel
{
return $panel
// ...
->plugins([
// ...
SettingsPlugin::make()
->pages([
\App\Filament\Pages\GeneralSettings::class,
\App\Filament\Pages\SeoSettings::class,
\App\Filament\Pages\OtherSettings::class,
]),
]);
}
public function mutateFormDataBeforeFill(array $data): array
{
return collect($data)->get($this->getTenantKey(), []);
}
public function mutateFormDataBeforeSave(array $data): array
{
return collect($data)->mapWithKeys(function ($item, $key) {
return ["{$this->getTenantKey()}.{$key}" => $item];
})->toArray();
}
/**
* A custom function for this example
*/
private function getTenantKey(): string
{
return 'tenant'; // Your logic to determine the tenant
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.