marshmallow/nova-date-range-field
Composer 安装命令:
composer require marshmallow/nova-date-range-field
包简介
A Laravel Nova field.
README 文档
README
Date Range Field for Laravel Nova
A Laravel Nova field that provides a date range picker (powered by flatpickr). It can store a range across two model attributes (a "from" and a "till"), as a single value, or as JSON.
Installation
Install the package via Composer in your Nova project:
composer require marshmallow/nova-date-range-field
The field's assets are registered automatically through Marshmallow\NovaDateRangeField\FieldServiceProvider (Laravel package auto-discovery), so there is nothing else to publish or configure.
Usage
Use the DateRange field on a Nova resource and define the names of the from and till attributes together with the label. If no fields are set, the string value is stored in the database column of the field's attribute.
use Marshmallow\NovaDateRangeField\DateRange; public function fields(Request $request) { return [ DateRange::make(__('Access Date'), ['from', 'till']), // OR DateRange::make(__('Access Date')) ->fields('from', 'till'), ]; }
flatpickr options
Additional flatpickr options can be passed through the options array. These overwrite the field's default options (weekNumbers, defaultHour, defaultMinute).
DateRange::make(__('Date range')) ->fields('from', 'till') ->options([ 'defaultHour' => 0, 'defaultMinute' => 0, ]),
Field options
The available chainable options (with their default behaviour) are:
->modeType('range') // Set the picker mode ('range' or 'single') ->range() // Range mode (default) ->single() // Single date mode ->twelveHourTime() // Twelve hour time display ->enableSeconds() // Enable seconds in the time picker ->separator('-') // Separator shown between the from/till values ->firstDayOfWeek(1) // First day of the week ->enableTime() // Enable the time picker ->dateFormat('Y-m-d') // flatpickr date format ->placeholder('date range') ->saveAsJSON() // Store the value as JSON instead of separate columns
When saveAsJSON() is used (or when the field's attribute is cast to array on the model), the range is stored as JSON on a single attribute instead of being split across the from and till columns.
Credits
Security Vulnerabilities
Please report security vulnerabilities by email rather than via the public issue tracker.
License
The MIT License (MIT). Please see the License File for more information.
marshmallow/nova-date-range-field 适用场景与选型建议
marshmallow/nova-date-range-field 是一款 基于 CSS 开发的 Composer 扩展包,目前已累计 11.01k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2023 年 02 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「nova」 「laravel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 marshmallow/nova-date-range-field 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 marshmallow/nova-date-range-field 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 marshmallow/nova-date-range-field 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Laravel Nova card that shows you your system information.
A Laravel Nova card.
A Laravel Nova package for publishable fields
A Laravel Nova package for translatable fields
A Laravel Nova Image field. you can paste or drag or chose an image
A Laravel Nova Mail testing tool.
统计信息
- 总下载量: 11.01k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-02-23