承接 zedmagdy/filament-business-hours 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

zedmagdy/filament-business-hours

Composer 安装命令:

composer require zedmagdy/filament-business-hours

包简介

A filament package for managing business hours with timezone support and exceptions.

README 文档

README

A Filament plugin for managing business hours with timezone support, multiple time slots per day, and exception handling.

Installation

composer require zedmagdy/filament-business-hours

Setup

1. Register the Plugin

In your Filament panel provider:

use ZEDMagdy\FilamentBusinessHours\FilamentBusinessHoursPlugin;

->plugins([
    FilamentBusinessHoursPlugin::make()
        ->timezone('Asia/Riyadh'), // optional
])

2. Add Database Columns

Add a JSON column to your model's table:

Schema::table('branches', function (Blueprint $table) {
    $table->json('business_hours')->nullable();
});

3. Configure Your Model

use ZEDMagdy\FilamentBusinessHours\Traits\HasBusinessHours;

class Branch extends Model
{
    use HasBusinessHours;

    protected function casts(): array
    {
        return [
            'business_hours' => 'array',
        ];
    }
}

Usage

Form Field

use ZEDMagdy\FilamentBusinessHours\Forms\Components\BusinessHoursField;

BusinessHoursField::make('business_hours')
    ->timezone()              // show timezone selector (default: true)
    ->allowExceptions()       // show exceptions section (default: true)
    ->collapsible()           // collapsible day sections (default: true)
    ->defaultTimezone('UTC')  // default timezone for new records
    ->columnSpanFull()

Table Column

use ZEDMagdy\FilamentBusinessHours\Tables\Columns\BusinessHoursColumn;

// Status badge (Open/Closed)
BusinessHoursColumn::make('business_hours')
    ->statusMode()

// Weekly schedule grid
BusinessHoursColumn::make('business_hours')
    ->scheduleMode()

Infolist Entry

use ZEDMagdy\FilamentBusinessHours\Infolists\Components\BusinessHoursEntry;

// Full schedule with exceptions
BusinessHoursEntry::make('business_hours')
    ->fullMode()

// Status badge only
BusinessHoursEntry::make('business_hours')
    ->statusMode()

// Compact single-line
BusinessHoursEntry::make('business_hours')
    ->compactMode()

Model Methods

$branch = Branch::first();

$branch->isOpen();              // true/false (current time)
$branch->isClosed();            // true/false
$branch->isOpenOn('monday');    // true/false
$branch->isClosedOn('sunday');  // true/false
$branch->nextOpen();            // Carbon instance
$branch->nextClose();           // Carbon instance
$branch->getBusinessTimezone(); // string

Configuration

Publish the config file:

php artisan vendor:publish --tag="filament-business-hours-config"

License

MIT

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-04-02

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固