shivanshrajpoot/nova-create-or-add
A Laravel Nova field that lets you create a new related resource or attach an existing one directly from a relationship form, streamlining inline workflows without leaving the parent resource.
Architecture fit. This is a leaf Nova field, not infrastructure. It registers a form control, publishes pre-compiled Vue assets, and reads/writes through the Eloquent relationship the app already owns. That makes it a clean fit for a sparse single-select relation (BelongsTo / MorphTo) inside Nova resource forms: no schema change, no data migration, and rollback is a one-line revert to native BelongsTo. It is a poor fit for core domain logic, BelongsToMany attach semantics, nested creation, or multi-record creation. The README claims HasMany support; treat that as unproven until the source read confirms it, because the safe scope described in diligence is single-select.
TPM framing: this should be treated as a reference-implementation decision, not a dependency adoption. At 9 stars, 0 dependents, and one maintainer, the realistic options are fork the pattern, reimplement it in-house (~1–2 dev-days), or stop if native Nova already covers the case.
Integration feasibility. Feasible as a field-for-field swap on one sparse BelongsTo, keeping the same foreign key column. The gates are: resolve provenance (Packagist shivanshrajpoot/nova-create-or-add vs GitHub Abhi0725/nova-create-or-add), verify composer.json constraints against the production Nova major, read src/, routes/, controllers, and resources/js/, then spike in staging. Native Nova must be ruled out first — BelongsTo::searchable() plus Nova’s built-in create-relation affordance may close the ticket at zero dependency cost.
Technical risk. Highest severity is authorization: inline creation embeds a write path in a form widget, and small Nova fields often post to custom search/create endpoints that skip the related model’s create policy. Second is silent failure: permissive version constraints can resolve cleanly and render a blank or inert field at runtime with no exception. Third is data integrity: create-then-attach is two operations, so without DB::transaction() you accumulate orphaned rows; without an idempotency guard, double-submit produces duplicates. Additional risks: stale pre-compiled assets after Nova upgrades, validation errors resetting the parent form and losing operator work, tenant-scoped search leakage, and bus factor of one.
Key questions.
BelongsTo, and does the Vue side honor nullable, rules, search, and default behavior?create policy evaluated?DB::transaction()? Is there a submit lock or server-side uniqueness guard?HasMany support safe, or should scope be restricted to single-select?Stack fit. Laravel + Nova only. It fits existing Nova resource forms and has no fit for Filament, Inertia, or custom admin surfaces. Verify PHP, Laravel, and Nova version alignment before any engineering time is committed.
Migration path. No schema migration. Replace the native BelongsTo on one sparse relation, keep the foreign key, and roll back by reverting the field line. If the spike succeeds, vendor the package via a path repository or private VCS fork and pin it. Add Dependabot for laravel/nova and laravel/framework, and record the coupling on the Nova upgrade checklist.
Compatibility. Test three axes independently: Composer resolution (fast and loud), asset publish/build (medium, sometimes loud), and runtime behavior (slow and silent). Republish assets after any Nova upgrade and confirm the published asset hash changed. Run CI against the exact Nova version used in production.
Sequencing.
BelongsTo::searchable() plus built-in create already covers the workflow.src/, routes/ and controllers, resources/js/, composer.json and service provider.BelongsTo.create; nullable relation left empty; double-submit produces no duplicate.Maintenance. TPM should treat this as an owned fork, not a vendor-supported dependency. Budget ~1 hour to vendor and pin, plus CI smoke tests, plus an entry on every Nova major upgrade. Each upgrade requires revalidating the PHP field class, the Vue component, and published assets.
Support. Bus factor is one and there is no community review. Engineering owns defects, policy patches, transaction boundaries, and idempotency fixes. Ops support impact is small if the UI stays native, but expect tickets phrased “I can’t find X” or duplicate-record reports if search/create behavior is flawed. Document troubleshooting: browser console first, network tab for search/create request scoping, then laravel.log for policy or validation exceptions.
Scaling. This is a UI widget; the scaling risk sits in the search endpoint. High-cardinality tables without pagination, debounce, and tenant scoping are both a performance and data-exposure problem. It is not appropriate for high-volume multi-record creation or BelongsToMany. Roll out per resource and measure time-to-create, support-ticket volume, orphaned-row counts, and duplicate-record incidents.
Failure modes and mitigations.
DB::transaction() in the fork.Ramp-up. Engineering needs roughly half a day to a day for the spike, tests, and fork; ops ramp-up is minimal because the control looks native. TPM governance should be a one-page decision record with success criteria — reduced time-to-create, fewer “can’t find X” tickets, zero orphan/duplicate incidents — a named owner, a rollback plan, and a Nova upgrade checkpoint. The low opportunity score reflects zero ecosystem leverage, not absence of user value; do not use it as the sole quality signal.
How can I help you explore Laravel packages today?