Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Filament Business Hours Laravel Package

zedmagdy/filament-business-hours

View on GitHub
Deep Wiki
Context7

Filament Business Hours

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

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
ecotone/kafka
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata