{"id":29628824,"url":"https://github.com/andreia/filament-business-hours-docs","last_synced_at":"2025-08-04T01:38:15.696Z","repository":{"id":300488817,"uuid":"1006299951","full_name":"andreia/filament-business-hours-docs","owner":"andreia","description":"Manage your business hours, bookings, and more with a feature-rich field that supports multiple time slots per day, recurring and date-based exceptions, and timezone-aware logic. Fully integrated with Spatie's Opening Hours for easy querying.","archived":false,"fork":false,"pushed_at":"2025-06-22T00:53:52.000Z","size":3511,"stargazers_count":7,"open_issues_count":1,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-21T09:21:08.616Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andreia.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-22T00:13:25.000Z","updated_at":"2025-07-19T07:41:54.000Z","dependencies_parsed_at":"2025-06-22T01:34:42.144Z","dependency_job_id":"c81392de-fb4c-47b1-9479-01c279112abd","html_url":"https://github.com/andreia/filament-business-hours-docs","commit_stats":null,"previous_names":["andreia/filament-business-hours-docs"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/andreia/filament-business-hours-docs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreia%2Ffilament-business-hours-docs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreia%2Ffilament-business-hours-docs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreia%2Ffilament-business-hours-docs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreia%2Ffilament-business-hours-docs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andreia","download_url":"https://codeload.github.com/andreia/filament-business-hours-docs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreia%2Ffilament-business-hours-docs/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268638197,"owners_count":24282510,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-03T02:00:12.545Z","response_time":2577,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-07-21T09:06:49.327Z","updated_at":"2025-08-04T01:38:15.673Z","avatar_url":"https://github.com/andreia.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Filament Business Hours Plugin\n\nA powerful and flexible Filament plugin for managing business hours in your application. Built on top of [spatie/opening-hours](https://github.com/spatie/opening-hours), this plugin provides a complete solution for handling business hours with an elegant Filament interface.\n\n![Filament Business Hours Form Field With Exceptions](https://raw.githubusercontent.com/andreia/filament-business-hours-docs/main/art/business_hours_form_field1.png)\n\n## Features\n\n### Rich Form Field\n- **Global Enable/Disable**: Toggle to quick enable/disable existing business hours\n- **Dynamic Time Slots**: Add multiple time ranges per day\n- **Timezone Support**: Built-in timezone selection with searchable dropdown\n- **Quick Toggles**: Enable/disable specific days with a single click\n- **Visual Feedback**: Clear visual indicators for open/closed status\n- **Flexible Layout**: Use Filament's available layout components for a responsive and customizable layout\n\n### Exception Management\n- **Date-based Exceptions**: Handle holidays, special hours, and closures\n- **Recurring Exceptions**: Set up annual recurring exceptions (e.g., Christmas)\n- **Date Ranges**: Define exceptions for specific date ranges\n- **Custom Labels**: Add descriptions to exceptions for better organization\n\n### Display Components\n- **Table Column**: Business days displayed as interactive circles with tooltips showing opening/closing times and distinct color for opening days.\n- **InfoList Entry**: Display formatted business hours with timezone and exceptions\n- **Widget Support**: Use as a standalone widget in your dashboard\n\n### Developer-Friendly\n- **Trait-based Integration**: Quick add business hours to any model with `HasBusinessHours` trait\n- **Cache Support**: Built-in caching for optimal performance\n- **Flexible Data Retrieving**: Rich set of methods for querying business hours with Spatie Opening Hours\n\n## Video\n\nTake a look at what Filament Business Hours can do in this short feature-packed video!  \n[![Filament Business Hours Youtube Video](https://raw.githubusercontent.com/andreia/filament-business-hours-docs/main/art/youtube_cover.jpg)](https://www.youtube.com/watch?v=5gXI0v3BwAU)\n\n## Screenshots\n\nForm Field\n\n![Filament Business Hours Form Field](https://raw.githubusercontent.com/andreia/filament-business-hours-docs/main/art/business_hours_form_field.png)\n\nForm Field with Exceptions\n\n![Filament Business Hours Form Field With Exceptions](https://raw.githubusercontent.com/andreia/filament-business-hours-docs/main/art/business_hours_form_field_exceptions.png)\n\nExceptions Modal\n\n![Filament Business Hours Form Field Exceptions Modal](https://raw.githubusercontent.com/andreia/filament-business-hours-docs/main/art/business_hours_form_field_exceptions_modal.png)\n\nTable Column\n\n![Filament Business Hours Table Column](https://raw.githubusercontent.com/andreia/filament-business-hours-docs/main/art/business_hours_table_column.png)\n\n![Filament Business Hours Table Column](https://raw.githubusercontent.com/andreia/filament-business-hours-docs/main/art/business_hours_table_column1.png)\n\n![Filament Business Hours Table Column](https://raw.githubusercontent.com/andreia/filament-business-hours-docs/main/art/business_hours_table_column2.png)\n\nInfolist Entry\n\n![Filament Business Hours Infolist Entry](https://raw.githubusercontent.com/andreia/filament-business-hours-docs/main/art/business_hours_infolist.png)\n\n## Requirements\n\n- PHP 8.2+\n- Filament 3\n\n## Dependencies\n\nThis package use the following dependencies:\n\n- [Spatie Opening Hours](https://github.com/spatie/opening-hours)\n- [Filament Timezone Field](https://github.com/TappNetwork/filament-timezone-field)\n- [Filament Table Repeater](https://github.com/awcodes/filament-table-repeater)\n\nBefore install the Business Hours Plugin, make sure the Table Repeater Filament plugin is configured according to the the docs:\nhttps://github.com/awcodes/filament-table-repeater?tab=readme-ov-file#installation\n\nFor more information about Spatie Opening Hours, please refer to the official [Spatie Opening Hours documentation](https://github.com/spatie/opening-hours).\n\n## Installation\n\n## Activating Your License on AnyStack\n\nFilament Business Hours uses AnyStack to handle payment, licensing, and distribution. [You can buy it here](https://checkout.anystack.sh/filament-business-hours).\n\nDuring the purchasing process, AnyStack will provide you with a license key. Once your license key is activated, you can proceed with the Composer installation described below.\n\n## Installing with Composer\n\nAdd the the Filament Business Hours package to repositories section of your `composer.json` file:\n\n```\n{\n    \"repositories\": [\n        {\n            \"type\": \"composer\",\n            \"url\": \"https://filament-business-hours.composer.sh\"\n        }\n    ]\n}\n```\n\nOnce the repository has been added to the `composer.json` file, you can install like any other Composer package using the `composer require` command:\n\n### Filament 3\n\nInstall the package via Composer:\n```bash\ncomposer require andreia/filament-business-hours\n```\n\nNext, you will be prompted to provide your username and password.\n\n```\nLoading composer repositories with package information\nAuthentication required (filament-business-hours.composer.sh):\nUsername: [license-email]\nPassword: [license-key]\n```\n\nYour username will be your email address and the password will be your license key. For example, let's say we have the following email and license activation:\n\n```\nContact email: your@email.com\nLicense key: 04c21df8f-4890-7024-y2vk-6bny143ta642\n```\n\nYou will need to enter the above information as follows when prompted for your credentials:\n\n```\nLoading composer repositories with package information\nAuthentication required (filament-business-hours.composer.sh):\nUsername: your@email.com\nPassword: 04c21df8f-4890-7024-y2vk-6bny143ta642\n```\n\n### Filament 4\n\nComing soon\n\n### Publish and run the migrations\n\n```bash\nphp artisan vendor:publish --tag=\"filament-business-hours-migrations\"\nphp artisan migrate\n```\n\n### Publish the config file (optional)\n\nYou can publish the config file with:\n\n```bash\nphp artisan vendor:publish --tag=\"filament-business-hours-config\"\n```\n\n### Publish Views (optional)\n\nOptionally, you can publish the views using:\n\n```bash\nphp artisan vendor:publish --tag=\"filament-business-hours-views\"\n```\n\n### Plublish Translations (optional)\n\nThe package comes with English translations out of the box. Publish the language files to customize:\n\n```bash\nphp artisan vendor:publish --tag=\"filament-business-hours-translations\"\n```\n\n### Add the Business Hours path in your Tailwind config file\n\nFilament recommends developers create a custom theme to better support plugin's additional TailwindCSS classes. After you have created your [custom theme](https://filamentphp.com/docs/3.x/panels/themes), add the Business Hours vendor views directory to your theme's `tailwind.config.js` file usually located in `resources/css/filament/admin/tailwind.config.js`:\n\n```js\n// ...\n\nexport default {\n    content: [\n        // ...\n        './vendor/andreia/filament-business-hours/resources/**/*.blade.php',\n    ],\n}\n```\n\n## Usage\n\n### Add Business Hours to Your Model\n\nThe `HasBusinessHours` Trait provides the `businessHours` relationship and convenient methods to quick build business/opening hours Spatie object. \n\nAdd the included `HasBusinessHours` trait to the model (e.g., `User`, `Team`, `Company` etc.) that you want to add business hours:\n\n```php\nuse Andreia\\FilamentBusinessHours\\Concerns\\HasBusinessHours;\n\nclass Business extends Model\n{\n    use HasBusinessHours;\n}\n```\n\nIt gives you:\n\n- A `morphOne` relationship to `BusinessHours`\n- An accessor to get `OpeningHours` as an instance\n- Helper methods to query if the entity is currently open, next opening time, next closing time, and more\n- Fully compatible with Spatie’s Opening Hours\n\n### Query Business Hours\n\n```php\n$modelWithBusinessHours = Company::find($companyId);\n\n// Check if business is open\n$modelWithBusinessHours-\u003eisOpen();\n\n// Get next opening time\n$nextOpen = $modelWithBusinessHours-\u003enextOpen();\n\n// Get current open range\n$range = $modelWithBusinessHours-\u003ecurrentOpenRange();\n\n// Check specific date/time\n$isOpen = $modelWithBusinessHours-\u003eisOpen(now()-\u003eaddDays(2));\n```\n\nYou can also use all Spatie's Opening Hours methods available to query and format the set of business/opening hours.\n\n### Use in Forms\n\n```php\nuse Andreia\\FilamentBusinessHours\\Forms\\Components\\BusinessHoursField;\n\nBusinessHoursField::make('businessHours')\n    -\u003eallowExceptions()\n```\n\nAny Form layout can be used to wrap the business hours, for example, using `Section`:\n\n```php\nuse Andreia\\FilamentBusinessHours\\Forms\\Components\\BusinessHoursField;\n\nForms\\Components\\Section::make('Business Hours')\n    -\u003edescription('Control the availability of hours on each weekday')\n    -\u003eicon('heroicon-o-clock')\n    -\u003eschema([\n        BusinessHoursField::make('businessHours')\n            -\u003eallowExceptions(),\n    ]),\n```\n\n#### Options\n\n**Allow Exceptions**\n\nTo allow the user provide exceptions to the business hours added, use the `-\u003eallowExceptions()` method. It will show the button to set up exceptions.\n\n```php\nuse Andreia\\FilamentBusinessHours\\Forms\\Components\\BusinessHoursField;\n\n$form-\u003eschema([\n    // ...\n    BusinessHoursField::make('businessHours')\n        -\u003eallowExceptions(),\n]),\n```\n\nThe exceptions can be added through a modal UI opened by the “Set up” button in the form.\n\nThe exceptions will be saved in Spatie-style on `exceptions` database column:\n\n```php\n'exceptions' =\u003e [\n    '2025-11-11' =\u003e ['09:00-12:00'],\n    '2025-07-04' =\u003e [],                  // closed all day\n    '01-01'      =\u003e [],                  // recurring annually\n    '12-25'      =\u003e ['09:00-12:00'],     // recurring annually\n    '12-25 to 12-25' =\u003e [\n        'hours' =\u003e [],\n        'data' =\u003e 'Holidays',\n    ],\n    '2025-06-25 to 2025-07-01' =\u003e [\n        'hours' =\u003e [],\n        'data' =\u003e 'Closed for works',\n    ],\n]\n```\n\n### Display in Tables\n\n```php\nuse Andreia\\FilamentBusinessHours\\Tables\\Columns\\BusinessHoursColumn;\n\n// businessHours is the name of the relationship\nBusinessHoursColumn::make('businessHours')\n```\n\n### Show in InfoLists\n\n```php\nuse Andreia\\FilamentBusinessHours\\Infolists\\Components\\BusinessHoursEntry;\n\n// businessHours is the name of the relationship\nBusinessHoursEntry::make('businessHours')\n```\n\nAny Infolist layout can be used to wrap the business hours, for example, using `Section`:\n\n```php\nuse Andreia\\FilamentBusinessHours\\Infolists\\Components\\BusinessHoursEntry;\nuse Filament\\Infolists;\n\nInfolists\\Components\\Section::make('Business Hours')\n    -\u003edescription('Control the availability of hours on each weekday')\n    -\u003eicon('heroicon-o-clock')\n    -\u003eschema([\n        BusinessHoursEntry::make('businessHours')\n            -\u003ehiddenLabel()\n            -\u003ecolumnSpanFull(),\n    ]),\n```\n\n## Testing\n\n```bash\ncomposer test\n```\n\n## Changelog\n\nPlease see [CHANGELOG](https://changelog.anystack.sh/filament-business-hours) for more information on what has changed recently.\n\n## Contributing\n\nUsers with active licenses may access the private repo to contribute by visiting the `Licenses` tab of your AnyStack account. \n\n## Need Assistance?\n\nIf you have any questions, find a bug, need support, or have a feature request or suggestion, please don't hesitate to reach out to me at [andreiabohner@gmail.com](mailto:andreiabohner@gmail.com). I'd love to hear from you.\n\n## Licensing Information\n\n### Single Project License\n\nThe Single Project license allows for the utilization of Filament Business Hours within a single project hosted on\none domain or subdomain. It is suitable for personal websites or websites tailored to specific clients.\n\nIf you intend to incorporate Filament Business Hours into a SaaS application, you must obtain an Unlimited Projects or\nLifetime license.\n\nUnder the Single Project license, you are authorized to activate Filament Business Hours up to 4 times (development,\ntest, staging, and production).\n\nYou will receive updates and bug fixes for one year from the purchase date. If you choose not to renew your license, you\ncan only install the plug-in up to the latest version available before the license expiration. Renewing the license at a\ndiscounted price allows you to continue receiving updates and new features.\n\n### Unlimited Projects License\n\nThe Unlimited Projects license permits the utilization of Filament Business Hours on **unlimited** domains, subdomains,\nand even in SaaS applications.\n\nYou will receive updates and bug fixes for one year from the purchase date. If you choose not to renew your license, you\ncan only install the plug-in up to the latest version available before the license expiration. Renewing the license at a\ndiscounted price allows you to continue receiving updates and new features.\n\n### Code Distribution\n\nPlease note that the licenses for Filament Business Hours does not allow the public distribution of its source code. Hence,\nyou cannot build and distribute applications publicly using Filament Business Hours source code on open-source platforms.\n\n### Questions About Licensing?\n\nIf you're uncertain about which license is appropriate for your needs, don't hesitate to reach out. Contact me at\n[andreiabohner@gmail.com](mailto:andreiabohner@gmail.com), and I'll be glad to assist you.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreia%2Ffilament-business-hours-docs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandreia%2Ffilament-business-hours-docs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreia%2Ffilament-business-hours-docs/lists"}