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

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

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

ianstudios/filament-settings

最新稳定版本:v1.0.3

Composer 安装命令:

composer require ianstudios/filament-settings

包简介

This package adds a way to interact with key:value settings in Filament.

README 文档

README

Latest Version on Packagist Total Downloads

This package adds a way to interact with key:value in Filament.

Installation

You can install the package via composer:

composer require ianstudios/filament-settings

Configure the Ianstudios/Settings package as described in the Settings documentation.

Add the plugin to your desired Filament panel:

use Ianstudios\FilamentSettings\Filament\Plugins\FilamentSettingsPlugin;

class FilamentPanelProvider extends PanelProvider
{
    public function panel(Panel $panel): Panel
    {
        return $panel
            // ...
            ->plugins([
                FilamentSettingsPlugin::make()
                    ->pages([
                        // Add your own setting pages here
                    ])
            ]);
    }
}

Usage

Create a settings page at 'app/Filament/Pages/Settings.php':

namespace App\Filament\Pages\Settings;

use Closure;
use Filament\Forms\Components\Tabs;
use Filament\Forms\Components\TextInput;
use Ianstudios\FilamentSettings\Filament\Pages\Settings as BaseSettings;

class Settings extends BaseSettings
{
    public function schema(): array|Closure
    {
        return [
            Tabs::make('Settings')
                ->schema([
                    Tabs\Tab::make('General')
                        ->schema([
                            TextInput::make('general.brand_name')
                                ->required(),
                        ]),
                    Tabs\Tab::make('Seo')
                        ->schema([
                            TextInput::make('seo.title')
                                ->required(),
                            TextInput::make('seo.description')
                                ->required(),
                        ]),
                ]),
        ];
    }
}

Register the setting page in the FilamentServiceProvider:

use Ianstudios\FilamentSettings\Filament\Plugins\FilamentSettingsPlugin;

class FilamentPanelProvider extends PanelProvider
{
    public function panel(Panel $panel): Panel
    {
        return $panel
            // ...
            ->plugins([
                FilamentSettingsPlugin::make()
                    ->pages([
                        App\Filament\Pages\Settings::class,
                    ])
            ]);
    }
}

You can add as many setting pages as you want. But when you do, make sure to override the public static function getNavigationLabel() : string method on your settings page. This is because multiple pages with the same navigation label will override each other in the Filament navigation.

Changing the navigation label

You can change the navigation label by overriding the getNavigationLabel method:

namespace App\Filament\Pages\Settings;

use Ianstudios\FilamentSettings\Filament\Pages\Settings as BaseSettings;

class Settings extends BaseSettings
{
    public static function getNavigationLabel(): string
    {
        return 'Custom label';
    }
}

Changing the page title

You can change the page title by overriding the getTitle method:

namespace App\Filament\Pages\Settings;

use Ianstudios\FilamentSettings\Filament\Pages\Settings as BaseSettings;

class Settings extends BaseSettings
{
    public function getTitle(): string
    {
        return 'Custom title';
    }
}

Changelog

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

License

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

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-08-26