{"id":49324243,"url":"https://github.com/mustafakhaleddev/filament-modal-notifications","last_synced_at":"2026-04-29T22:01:11.009Z","repository":{"id":353554906,"uuid":"1219137028","full_name":"mustafakhaleddev/filament-modal-notifications","owner":"mustafakhaleddev","description":"Render any Filament notification as a blocking modal","archived":false,"fork":false,"pushed_at":"2026-04-24T10:39:07.000Z","size":6,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-04-28T21:31:50.879Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","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/mustafakhaleddev.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-23T15:08:26.000Z","updated_at":"2026-04-28T13:32:49.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/mustafakhaleddev/filament-modal-notifications","commit_stats":null,"previous_names":["mustafakhaleddev/filament-modal-notifications"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/mustafakhaleddev/filament-modal-notifications","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mustafakhaleddev%2Ffilament-modal-notifications","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mustafakhaleddev%2Ffilament-modal-notifications/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mustafakhaleddev%2Ffilament-modal-notifications/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mustafakhaleddev%2Ffilament-modal-notifications/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mustafakhaleddev","download_url":"https://codeload.github.com/mustafakhaleddev/filament-modal-notifications/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mustafakhaleddev%2Ffilament-modal-notifications/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32445555,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T20:22:27.477Z","status":"ssl_error","status_checked_at":"2026-04-29T20:22:26.507Z","response_time":110,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":"2026-04-26T19:04:00.247Z","updated_at":"2026-04-29T22:01:10.959Z","avatar_url":"https://github.com/mustafakhaleddev.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Filament Modal Notifications\n\nRender any Filament notification as a blocking modal by chaining one method: `-\u003easModal()`. Multiple modal notifications fired in the same request are queued one at a time — the user dismisses one and the next slides in, no stacking.\n\nEverything else you already know about Filament notifications (title, body, icon, color, actions, `danger()`/`success()`/`warning()`/`info()`) carries over unchanged.\n\n## Requirements\n\n- PHP 8.2+\n- Laravel 11+ / 13\n- Filament 4 or 5\n\n## Features\n\n- **One-line opt-in** — chain `-\u003easModal()` onto any `Notification::make()` call. No new classes to learn.\n- **Queued** — multiple modal notifications show one at a time, dismissal advances to the next.\n- **Auto-added Close button** — if the developer didn't declare actions, the modal gets a \"Close\" button in its footer so it's always dismissible.\n- **Respects your actions** — if you declare `-\u003eactions([...])`, those render in the footer instead.\n- **Conditional** — `-\u003easModal($isCritical)` is a no-op when the condition is false, so the notification sends as a regular toast.\n- **Independent of the toast tray** — modal notifications never briefly flash as toasts; they use a dedicated session key and Livewire event.\n- **Plugin-level defaults** — set the default modal width, closable behavior, and close button label per panel.\n\n## Installation\n\n```bash\ncomposer require wezlo/filament-modal-notifications\n```\n\nRegister the plugin on your panel so the Livewire component mounts at the page footer:\n\n```php\nuse Wezlo\\FilamentModalNotifications\\FilamentModalNotificationsPlugin;\n\npublic function panel(Panel $panel): Panel\n{\n    return $panel\n        -\u003eplugins([\n            FilamentModalNotificationsPlugin::make(),\n        ]);\n}\n```\n\nOptionally publish the config:\n\n```bash\nphp artisan vendor:publish --tag=filament-modal-notifications-config\n```\n\n## Quick Start\n\n```php\nuse Filament\\Notifications\\Notification;\n\nNotification::make()\n    -\u003etitle('Changes not saved')\n    -\u003ebody('Your unsaved edits will be lost if you leave this page.')\n    -\u003edanger()\n    -\u003easModal()\n    -\u003esend();\n```\n\nThat's it. On the next Livewire cycle, a modal opens with the title, body, and a default Close button. Regular toasts still work exactly as before — only notifications with `-\u003easModal()` go through the modal pipeline.\n\n## Usage\n\n### With custom actions\n\nThe notification's actions render in the modal footer:\n\n```php\nuse Filament\\Actions\\Action;\nuse Filament\\Notifications\\Notification;\n\nNotification::make()\n    -\u003etitle('Delete this order?')\n    -\u003ebody('This cannot be undone.')\n    -\u003ewarning()\n    -\u003eactions([\n        Action::make('cancel')-\u003elabel('Cancel')-\u003ecolor('gray')-\u003eclose(),\n        Action::make('delete')-\u003elabel('Delete')-\u003ecolor('danger')\n            -\u003eaction(fn () =\u003e $this-\u003erecord-\u003edelete())\n            -\u003eclose(),\n    ])\n    -\u003easModal()\n    -\u003esend();\n```\n\nWhen any action's `-\u003eclose()` is invoked (or the user clicks X / Esc / clicks outside if closable), the queue advances to the next pending modal notification.\n\n### Conditional modal\n\n`-\u003easModal(false)` leaves the notification as a normal toast:\n\n```php\nNotification::make()\n    -\u003etitle($wasCritical ? 'Error' : 'Saved')\n    -\u003easModal($wasCritical)\n    -\u003esend();\n```\n\n### Queued — multiple in one request\n\n```php\nNotification::make()-\u003etitle('Step 1 complete')-\u003easModal()-\u003esend();\nNotification::make()-\u003etitle('Step 2 complete')-\u003easModal()-\u003esend();\nNotification::make()-\u003etitle('Step 3 complete')-\u003easModal()-\u003esend();\n```\n\nThe user sees one modal at a time in FIFO order. Each dismissal advances to the next. When the queue is empty the modal closes.\n\n### Panel-level defaults\n\n```php\nuse Filament\\Support\\Enums\\Width;\nuse Wezlo\\FilamentModalNotifications\\FilamentModalNotificationsPlugin;\n\n-\u003eplugins([\n    FilamentModalNotificationsPlugin::make()\n        -\u003edefaultWidth(Width::Large)\n        -\u003edefaultClosable(false)        // block Esc / click-away / X — require an explicit action\n        -\u003edefaultCloseButtonLabel('Dismiss'),\n])\n```\n\n| Method | Type | Default | Description |\n|---|---|---|---|\n| `defaultWidth(Width\\|string)` | enum/string | `md` | Modal width (`sm`, `md`, `lg`, `xl`, `2xl`, …, `screen`) |\n| `defaultClosable(bool)` | bool | `true` | Whether the modal can be dismissed via X, Esc, or click-away |\n| `defaultCloseButtonLabel(string)` | string | `Close` | Label for the auto-added Close action |\n\n## Default Config File\n\n```php\n// config/filament-modal-notifications.php\nreturn [\n    'default_width' =\u003e 'md',\n    'default_closable' =\u003e true,\n    'default_close_label' =\u003e 'Close',\n];\n```\n\n## How It Works\n\n- **`-\u003easModal()` is a macro** registered on `Filament\\Notifications\\Notification` in the service provider. It returns a `Wezlo\\FilamentModalNotifications\\ModalNotification` — a subclass that overrides `send()` to push into a dedicated session key (`filament.modal-notifications`) instead of the default `filament.notifications`.\n- **A custom dehydrate hook** dispatches the `modalNotificationsSent` Livewire event when the modal session key has pending notifications (same pattern Filament uses for its toast tray).\n- **A Livewire component** (`Wezlo\\FilamentModalNotifications\\Livewire\\ModalNotifications`) mounts at `PanelsRenderHook::BODY_END`. It listens for `modalNotificationsSent`, drains the session key into an in-component queue, and renders the first pending notification through `\u003cx-filament::modal\u003e`. When the user dismisses the modal (X, Esc, click-away, or any action chained with `-\u003eclose()`), the component advances to the next queued notification.\n- **No toast flash** — because modal notifications use a separate session key, the default toast tray never sees them.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmustafakhaleddev%2Ffilament-modal-notifications","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmustafakhaleddev%2Ffilament-modal-notifications","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmustafakhaleddev%2Ffilament-modal-notifications/lists"}