digital-creative/nova-inline-morph-to
A Laravel Nova field for inline morphTo editing: create and update polymorphic related records directly from the parent resource form, without leaving the page. Streamlines data entry and polymorphic relationship workflows in Nova.
Architecture fit
morphTo relationship inline (resolved related-resource title/link) in index and detail views, where Nova's stock MorphTo field normally defers to a link-out.Integration feasibility
composer require, then swap MorphTo::make(...) for the package's field class in the relevant Nova resources. Expect well under a day for a first resource, including verification.morphTo relationship with a properly registered morph map (Relation::enforceMorphMap or equivalent) so the field can resolve the related resource type reliably.Technical risk
morphTo can expose titles of models a user should not see.Key questions
composer.json constraints for PHP, Laravel, and Nova?morphWith eager loading, or is it display-only?Stack fit
morphTo relationships already in use (e.g., comments/attachments/activity records pointing at multiple parent types).Migration path
MorphTo::make() usages in Nova resources and identify which ones actually suffer from the link-out UX problem the package solves.composer remove plus reverting the field definitions — a single PR, no state cleanup.Compatibility
composer update time.morphTo targets a model whose Nova resource is customized (custom title, custom index query), confirm the field picks up the resource's title() rather than a raw attribute.Sequencing
MorphTo field — the UX loss is cosmetic, so this is a cheap abort.Maintenance
^x.y. Expect this package to receive irregular updates and to lag Nova majors by weeks or months.app/Nova/Fields converts an external dependency into an internally owned ~100-line file and eliminates the bus-factor risk entirely. This is likely the right long-term move given 34 stars and 0 dependents.Support
Scaling
morphTo on an index view can produce one lookup per row across multiple concrete types. On a 50-row index with three morph types, that is a visible page-time regression.morphWith where the field supports it), and by limiting the field to detail views if index performance degrades.Failure modes
| Failure | Symptom | Impact | Mitigation |
|---|---|---|---|
| Nova major upgrade | Field class no longer resolves; column blank or exception | Admin index page broken | Pilot resource test pre-upgrade; fallback to native MorphTo |
| Unregistered/renamed morph alias | Blank or wrong title rendered | Misleading admin data | Enforce morph map; add a smoke test on pilot resource |
| Deleted related model | Null/exception on orphaned morph | Column error | Verify null-safety; consider ->nullable() and soft-delete policy |
| Missing policy check | Titles of unauthorized records displayed | Information disclosure to admin users | Test with a restricted role; drop field if policies are ignored |
| N+1 queries | Slow index pages at scale | UX degradation, DB load | Query-count baseline; eager loading; restrict to detail view |
| Upstream abandonment | No fixes for future Nova | Slow decay | Vendor the class into app namespace |
Ramp-up
Recommendation: Adopt narrowly and pin, with a preference for vendoring the field into the application once it proves useful on the pilot resource. Value is real but cosmetic; treat it as a UX convenience with an explicit native-MorphTo fallback rather than as load-bearing infrastructure.
How can I help you explore Laravel packages today?