outerweb/filament-settings 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

outerweb/filament-settings

最新稳定版本:v2.1.0

Composer 安装命令:

composer require outerweb/filament-settings

包简介

Filament integration for the outerweb/settings package

README 文档

README

Filament Settings

Filament Settings

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This Filament plugin provides an integration for the outerweb/settings package.

Table of Contents

Installation

You can install the package via composer:

composer require outerweb/filament-settings

Follow the installation instructions for the outerweb/settings package.

Add the plugin to your panel:

use Outerweb\FilamentSettings\SettingsPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        // ...
        ->plugins([
            // ...
            SettingsPlugin::make()
                ->pages([
                    // Add your settings pages here
                ]),
        ]);
}

Usage

Create a Page

Create a settings page by extending Outerweb\FilamentSettings\Pages\Settings:

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')
                                    ->required(),
                            ]),
                        Tab::make('Seo')
                            ->schema([
                                TextInput::make('seo.title')
                                    ->required(),
                                TextInput::make('seo.description')
                                    ->required(),
                            ]),
                    ]),
            ]);
    }
}

Creating multiple pages

You can create as many settings pages as you want.

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,
                ]),
        ]);
}

Each page just needs to extend Outerweb\FilamentSettings\Pages\Settings. You can override the all properties like the icon, navigationGroup... just like a normal Filament page.

Mutating settings data

You can mutate the settings before filling the form and before saving them to the database by defining the mutateFormDataBeforeFill and mutateFormDataBeforeSave methods.

For example, if you want to store all settings under a specific tenant key:

    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
    }

Changelog

Please see CHANGELOG for more information on what has changed recently.

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 73.37k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 36
  • 点击次数: 0
  • 依赖项目数: 8
  • 推荐数: 0

GitHub 信息

  • Stars: 36
  • Watchers: 1
  • Forks: 20
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固