定制 idez/nova-date-range-filter 二次开发

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

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

idez/nova-date-range-filter

Composer 安装命令:

composer require idez/nova-date-range-filter

包简介

A Laravel Nova date range filter.

README 文档

README

License Latest Stable Version Total Downloads

About

This is a configurable and ready to use filter for Laravel Nova 4 based on Nova's own date filter that displays a date range picker.

Installation

To install the filter run the following command in your Laravel Nova project:

composer require idez/nova-date-range-filter

Usage

Simply add this filter to the filters method in your Nova resource.

use Illuminate\Http\Request;
use Idez\DateRangeFilter\DateRangeFilter;

class CustomResource extends Resource
{
    public function filters(Request $request): array
    {
        return [
            new DateRangeFilter(),
        ];
    }
}

By default, this will create a filter named "Created at" which applies the selected date range to the created_at database column.

Customization

The filter takes up to three arguments to customize it to your needs.

Parameter Type Description Default
Name String The name of the filter how it should appear in the filter dropdown list. "Created at"
Column String The name of the database column on which the selected date range should be applied to. Illuminate\Database\Eloquent\Model::CREATED_AT
Settings Array An array of settings to customize the filter. See the configuration section below for details. []

Configuration

All available settings are provided by the included Config enum. See the full example below how to use it.

Setting Type Description Default
ALLOW_INPUT Boolean Allows the user to enter a date directly into the input field. false
DATE_FORMAT String A string of characters which are used to define how the date will be displayed in the input box. The supported characters are defined in this table. "Y-m-d"
DEFAULT_DATE Array Sets the initial selected dates.

Supply an array of date strings which follow the format Y-m-d.
null
DISABLED Boolean Entirely disables the filter. false
ENABLE_TIME Boolean Enables the time picker. false
ENABLE_SECONDS Boolean Enables seconds in the time picker. false
FIRST_DAY_OF_WEEK Integer Sets the first day of the week (0 = Sunday, 1 = Monday etc.). If a custom locale is used, this setting has no effect. 0
LOCALE String Localizes the filter. Available locales can be found here. "default"
MAX_DATE String The maximum date that a user can pick to (inclusive). null
MIN_DATE String The minimum date that a user can start picking from (inclusive). null
PLACEHOLDER String The text that is shown in the empty input box. __('Choose date range')
SHORTHAND_CURRENT_MONTH Boolean Shows the month using the shorthand version (e.g. Sep instead of September). false
SHOW_MONTHS Integer The number of months that should be showed. 1
TIME24HR Boolean Displays the time picker in 24 hour mode without AM/PM selection when enabled. false
WEEK_NUMBERS Boolean Enables the display of week numbers in the calendar. false

Full Example

use Illuminate\Http\Request;
use Idez\DateRangeFilter\DateRangeFilter;
use Idez\DateRangeFilter\Enums\Config;

class CustomResource extends Resource
{
    public function filters(Request $request): array
    {
        return [
            new DateRangeFilter('Created at', 'created_at', [
                Config::ALLOW_INPUT => false,
                Config::DATE_FORMAT => 'Y-m-d',
                Config::DEFAULT_DATE => ['2019-06-01', '2019-06-30'],
                Config::DISABLED => false,
                Config::ENABLE_TIME => false,
                Config::ENABLE_SECONDS => false,
                Config::FIRST_DAY_OF_WEEK => 0,
                Config::LOCALE => 'default',
                Config::MAX_DATE => '2019-12-31',
                Config::MIN_DATE => '2019-01-01',
                Config::PLACEHOLDER => __('Choose date range'),
                Config::SHORTHAND_CURRENT_MONTH => false,
                Config::SHOW_MONTHS => 1,
                Config::TIME24HR => false,
                Config::WEEK_NUMBERS => false,
            ]),
        ];
    }
}

Screenshots

Default configuration Showing 2 months
Date range filter (default) Date range filter (2 months)

Contributing

Contributions are welcome, explain the issue/feature that you want to solve/add and back your code up with tests. Happy coding!

License

This package was originally developed by https://github.com/pos-lifestyle/laravel-nova-date-range-filter however they have abandoned the package. The MIT License (MIT). Please see License File for more information.

idez/nova-date-range-filter 适用场景与选型建议

idez/nova-date-range-filter 是一款 基于 Vue 开发的 Composer 扩展包,目前已累计 106.67k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2022 年 06 月 10 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 idez/nova-date-range-filter 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 2
  • Watchers: 0
  • Forks: 55
  • 开发语言: Vue

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-06-10