定制 vodafoneziggonl/filament-multi-widget 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

vodafoneziggonl/filament-multi-widget

最新稳定版本:3.0.0

Composer 安装命令:

composer require vodafoneziggonl/filament-multi-widget

包简介

A Filament widget that encompasses multiple widgets.

README 文档

README

GitHub repository cover image

Combine multiple widgets into one

Latest Version Total Downloads

This package adds a new type of widget to your Filament application. The Multi Widget allows you to combine multiple widgets into a single widget, that can be switched using tabs. This plugin helps clean up your Filament dashboard.

Demo

Installation

This package can be installed via Composer:

composer require vodafoneziggonl/filament-multi-widget

Usage

Create a new Multi Widget by extending the VodafoneZiggoNL\MultiWidget\MultiWidget class.

// app/Filament/Widgets/UserMultiWidget.php

class UserMultiWidget extends MultiWidget
{
    public array $widgets = [
        MySubmittedComments::class,
        MySubmittedFeedback::class,
        MySubscriptions::class,
    ];
}

The $widgets property contains the classes of all the widgets that should be added to your Multi Widget. These are normal Filament widgets that you created.
The Multi Widget above will now render as follows:

Example multi widget

In case your widget is displayed a second time on the dashboard, make sure the widget is not automatically added to the dashboard again. Check the discoverWidgets() function in your adminPanelProvider.php file.

Using custom labels for tabs

By default, the label name is generated based on the class name. If you want to customize the label for the tab, add the getDisplayName() method to your widget.

// app/Filament/Widgets/ProductSales.php

class ProductSales extends BaseWidget
{
   // Some widget content...
   
    public function getDisplayName(): string {
        return "Custom name";
    }
}

Persist tabs in session

To persist the tabs in the user's session, use the shouldPersistMultiWidgetTabsInSession() method:

// app/Filament/Widgets/UserMultiWidget.php

class UserMultiWidget extends MultiWidget
{
    public array $widgets = [
        MySubmittedComments::class,
        MySubmittedFeedback::class,
        MySubscriptions::class,
    ];
    
    public function shouldPersistMultiWidgetTabsInSession(): bool
    {
        return true;
    }
}

Contributing

Please see CONTRIBUTING for details.

Credits

License

The Apache License 2.0. Please see License File for more information.

统计信息

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

GitHub 信息

  • Stars: 17
  • Watchers: 3
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-07-22