markwalet/nova-modal-response
A Laravel Nova package that lets actions return modal responses. Show custom content, confirmations or messages in a modal without leaving the page—just return a ModalResponse from your action's handle method.
Architecture fit
ModalResponse / Block) emits a JSON payload consumed by a bundled JS/Vue renderer inside a Nova action modal. No persistence, no queues, no service dependencies, no domain logic. A defect or a bad upgrade is contained to admin-panel action responses — nothing customer-facing, nothing in the request path of the product.Size/Variant/Alignment enums. That typed block model is what makes it viable as a team-wide standard for admin messaging rather than a one-off convenience: it is a governed content-authoring abstraction, not just a modal helper.Integration feasibility
ModalResponse fluent API "usually just bump the dependency." Breakage concentrates in exactly two places — hand-built payloads via Action::modal('modal-response', [...]) (payload became { title, size, closeButtonText, blocks: [...] }) and the removed withoutSyntaxHighlighting() (deprecated since v1.1.3).Technical risk
console.warn — no PHP exception, no failing test unless we assert payload shape. This cannot be mitigated by the library; it must be mitigated by process (golden-payload test + manual QA pass).markdown, html, and view blocks render as given; Markdown preserves javascript: links and most raw HTML. Establish an internal convention now: view blocks render repo-controlled Blade only, markdown comes from static strings, and untrusted or AI-generated content uses text/list/code blocks or passes through a sanitization layer first.Key questions
Action::modal('modal-response', [...]) directly, or call withoutSyntaxHighlighting()? This is a single grep and it decides whether the upgrade is a bump or a scoped migration.Stack fit
Action::message(...) for one-line confirmations, Action::download(...) for files, Action::redirect(...)/Action::visit(...) for navigation, ModalResponse only when the result is something the user should read or inspect. Without that convention the package gets used for toasts and the abstraction loses its value.Migration path
Action::modal('modal-response', withoutSyntaxHighlighting, and the legacy payload keys (body, code, html, highlight). Record every modal-returning action — that list is the QA scope.ModalResponse/Block factory API rather than hand-authoring the new payload shape — hand-authoring is what broke, and the factory is the supported path.{ title, size, closeButtonText, blocks: [...] } structure for a representative action. This is the single highest-leverage artifact from the whole upgrade: it is what prevents a future v3 from silently breaking modals again.Compatibility
ModalResponse API is source-compatible. Most consumers are on the cheap path.Sequencing
Maintenance
Support
Scaling
view blocks or heavy JSON payloads shipped into a modal will feel sluggish; keep modal payloads small and link out for anything large. Set that expectation early.Failure modes
markdown/html/view blocks with untrusted input → script injection into the admin panel. Prevention: the convention above, plus code review attention on any view block whose data originates from request input or a model field an end user can write.Ramp-up
stack(), and the block catalogue. An engineer unfamiliar with the package can ship a first rich modal in under an hour.inline + badge + code, a changelog modal with heading + list + divider, a troubleshooting modal with collapsible + link — and teams will pattern-match rather than invent.How can I help you explore Laravel packages today?