ahmed-hussain/hasmany-to-modal
A Laravel package for working with hasMany relationships through modals, helping you create and manage related records in a popup without leaving the parent page. Useful for simplifying nested relationship forms and reducing extra navigation in admin panels and CRUD interfaces.
What the package is. ahmed-hussain/hasmany-to-modal is a Laravel Nova field extension that swaps the default inline HasMany table on a resource detail page for a button + modal workflow. Instead of rendering all related records inline, the user opens a modal to view, create, and edit related records. It is a UI ergonomics package, not infrastructure — it changes presentation and interaction, not data modeling or persistence semantics.
Architecture fit. Fit is narrow and conditional: it only matters if the application runs Laravel Nova, which is a commercial, closed-source product with its own release cadence. Nova's field layer is a thin PHP class (Laravel\Nova\Fields\HasMany subclasses) plus a compiled Vue component registered against Nova's internal component API. That means the package is tightly coupled to Nova internals rather than to documented Laravel contracts. Where the app already has detail pages with large HasMany tables (line items, audit logs, attachments, child records), the fit is good; everywhere else it is inert. Assess this as a Nova UI enhancement, not as a general Laravel dependency.
Integration feasibility. Mechanically trivial: composer require, then substitute HasManyToModal::make('Items') for HasMany::make('Items') in the resource's fields() method. No migrations, no schema changes, no service provider configuration expected. Effort is measured in hours per resource, not sprints. The real feasibility question is version compatibility with the Nova major version in use, which the package metadata does not answer clearly.
Technical risk. High relative to value.
Key questions to answer before adoption.
Laravel\Nova\Fields\HasMany or reimplement the relationship controller?canSee/canCreate/canUpdate authorization callbacks honored inside the modal?relatable query scoping), or create-only?Stack fit. Requires Laravel + Nova. Typical target: Laravel 10/11 with Nova 4.x or 5.x, PHP 8.1+. If the product does not have a Nova license, this package is entirely out of scope and should be closed as not-applicable. If Nova is present but only used as an internal admin, the value is real but bounded — an admin-UX improvement for a small internal audience.
Migration path. Non-destructive and incremental. Existing HasMany fields keep working; the package is applied field-by-field, resource-by-resource. Recommended sequence:
packages/ or a private VCS repo and pin the commit. At 1 star and 0 dependents, treating it as an unmaintained upstream is the only defensible posture; a fork also lets you patch Nova-compat breaks without waiting.HasMany.Compatibility. Treat Nova majors as breaking by default. Add a CI job that boots the Nova version in use and asserts the resource detail page renders and the modal opens; without that, a routine composer update can silently destroy an admin page. Record the exact Nova + package commit pairing in the dependency ledger.
Sequencing relative to other work. This should not block or gate any roadmap item. It is a self-contained admin polish task, appropriate for a maintenance window or a low-priority backlog slot. If the team is mid-Nova-upgrade, defer until the Nova version is settled.
Maintenance. Expect to own it. The upstream release cadence is effectively dormant (one release, May 2024), so plan for the fork to diverge. Budget a small recurring allowance for Nova-upgrade compatibility checks each time Nova ships a major; that is the only recurring cost, and it is modest but non-zero.
Support. No vendor, no SLA, no community. Internal documentation should state plainly: forked from an unmaintained MIT package, maintained by , patched for Nova . Anyone debugging a broken admin detail page needs to know this field is a customization layer and not stock Nova.
Scaling. The modal is a UI container; the scaling question is whether it paginates. Inline HasMany tables in Nova already stream via relationship endpoints, and a modal that naively fetches all children will regress both page-load time and memory on high-cardinality relations. Constrain usage to relations with bounded child counts (roughly under a few hundred rows) until pagination behavior is proven. Avoid applying it to the largest relations in the schema.
Failure modes to plan for.
Ramp-up. Very low for any developer already fluent in Nova custom fields — the API surface is one field class, and the change is a drop-in substitution. For developers without Nova experience, the learning cost sits with Nova's field/component model, not with this package. Provide a short internal note: what the field replaces, how to revert, and where the fork lives.
Recommendation. Adopt only as a vendored, pinned, forked utility for a small number of bounded HasMany relations in an existing Nova admin, after explicit authorization and pagination verification. Do not adopt as a direct Composer dependency on a strategic path, and do not let it into any customer-facing surface. The value is real but cosmetic; the risk is small but entirely yours to carry.
How can I help you explore Laravel packages today?