定制 maarheeze/calendar-date-laravel 二次开发

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

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

maarheeze/calendar-date-laravel

最新稳定版本:1.1.0

Composer 安装命令:

composer require maarheeze/calendar-date-laravel

包简介

laravel integration for a timezone-agnostic calendar date value object

README 文档

README

Laravel integration for maarheeze/calendar-date.

Requirements

  • PHP 8.2+
  • Laravel 8+

Installation

composer require maarheeze/calendar-date-laravel

Usage

Eloquent cast

use Maarheeze\CalendarDate\Casts\CalendarDateCast;

class Article extends Model
{
    protected $casts = [
        'publication_date' => CalendarDateCast::class,
    ];
}

The cast handles null, string, and DateTimeInterface values from the database, and stores as Y-m-d.

Blade

Since CalendarDate implements __toString(), it renders directly in Blade:

{{ $article->publication_date }} // results in 2000-01-01
{{ $article->publication_date->format('d-m-Y') }} // results in 01-01-2000

Validation

Use a custom constraint for validation in form requests:

use Maarheeze\CalendarDate\Rules\CalendarDateRule;

public function rules(): array
{
    return [
        'publication_date' => ['required', new CalendarDateRule(max: 'today')],
    ];
}

License

MIT

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-03-06

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固