webbingbrasil/filament-advancedfilter 问题修复 & 功能扩展

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

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

webbingbrasil/filament-advancedfilter

Composer 安装命令:

composer require webbingbrasil/filament-advancedfilter

包简介

Advanced filter component for filament admin.

README 文档

README

AdvancedFilters

A collection of easy-to-use filters with clause conditions to Filament

Note For Filament 2.x use 2.x branch

Installation

Install the package via composer (requires filament >= 3.x)

composer require webbingbrasil/filament-advancedfilter "^3.0"

Optionally you can publish the translation files

php artisan vendor:publish --tag="filament-advancedfilter-translations"

Available Filters

BooleanFilter

Filter records by boolean column:

use Webbingbrasil\FilamentAdvancedFilter\Filters\BooleanFilter;

BooleanFilter::make('is_active')

In some cases you can have a nullable column, the BooleanFilter can handle nulls in different ways:

  • Treats nulls as Unknown
  • Treats nulls as True
  • Treats nulls as False

by default nulls are treated as unknown and hidden

BooleanFilter::make('is_active')->nullsAreUnknown();
BooleanFilter::make('is_active')->nullsAreTrue();
BooleanFilter::make('is_active')->nullsAreFalse();
BooleanFilter::make('is_active')->showUnknowns();
BooleanFilter::make('is_active')->hideUnknowns();

DateFilter

Filter records by date/timestamp column:

use Webbingbrasil\FilamentAdvancedFilter\Filters\DateFilter;

DateFilter::make('published_at')

This filter allows users to search records in the following conditions:

  • Is equal/not equal to user's input

  • Is on or after/before user's input

  • Is more/less than user's input

    the user has the option to choose a time interval (day, week, month, year) in the future/past, for example:

    • more than 3 days from now
    • more than 4 months ago
    • less than 5 weeks from now
    • less than 6 days ago
    • more than 1 year ago
  • Is between user's input

  • Is set/not set

NumberFilter

Filter records by numeric column:

use Webbingbrasil\FilamentAdvancedFilter\Filters\NumberFilter;

NumberFilter::make('quantity')

This filter allows users to search records in the following conditions:

  • Is equal/not equal to user's input
  • Is on or after/before user's input
  • Is more than/less than user's input
  • Is between user's input
  • Is set/not set

TextFilter

Filter records by text column:

use Webbingbrasil\FilamentAdvancedFilter\Filters\TextFilter;

TextFilter::make('name')

This filter allows users to search records in the following conditions:

  • Is equal/not equal to user's input
  • Starts/not starts with user's input
  • Ends/not ends with user's input
  • Contains/not contains user's input
  • Is set/not set

Set Default Clause

You can set a default clause condition for any filter, for example:

use Webbingbrasil\FilamentAdvancedFilter\Filters\TextFilter;
use Webbingbrasil\FilamentAdvancedFilter\Filters\BooleanFilter;

FilamentAdvancedFilter\Filters\TextFilter::make('brand')
    ->relationship('brand', 'name')
    ->default(FilamentAdvancedFilter\Filters\TextFilter::CLAUSE_CONTAIN);
    
FilamentAdvancedFilter\Filters\BooleanFilter::make('is_visible')
    ->default(FilamentAdvancedFilter\Filters\BooleanFilter::CLAUSE_IS_FALSE);

Enable Clause Label

By default the clause label is disabled, you can enable it by calling the enableClauseLabel method:

use Webbingbrasil\FilamentAdvancedFilter\Filters\TextFilter;

FilamentAdvancedFilter\Filters\TextFilter::make('brand')
    ->enableClauseLabel()

Fields Wrapper

You can change the wrapper for the filter fields, for example to use a Group component instead of Fieldset:

use Webbingbrasil\FilamentAdvancedFilter\Filters\TextFilter;

FilamentAdvancedFilter\Filters\TextFilter::make('brand')
    ->enableClauseLabel()
    ->wrapperUsing(fn () => Forms\Components\Group::make())

Field Debounce

You can set a custom debounce time for the filter fields, for example to wait 700ms before applying the filter:

use Webbingbrasil\FilamentAdvancedFilter\Filters\TextFilter;

FilamentAdvancedFilter\Filters\TextFilter::make('brand')
    ->debounce(700)

By default the debounce time is 500ms.

Credits

License

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

webbingbrasil/filament-advancedfilter 适用场景与选型建议

webbingbrasil/filament-advancedfilter 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 142.5k 次下载、GitHub Stars 达 148, 最近一次更新时间为 2022 年 04 月 08 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「filter」 「laravel」 「filament」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 webbingbrasil/filament-advancedfilter 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 webbingbrasil/filament-advancedfilter 我们能提供哪些服务?
定制开发 / 二次开发

基于 webbingbrasil/filament-advancedfilter 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 148
  • Watchers: 5
  • Forks: 33
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-04-08