webparking/nova-belongs-to-dependency
A Laravel Nova package that makes BelongsTo fields depend on other form fields, enabling cascading or filtered selects. Choose a parent value and the related BelongsTo options update accordingly, keeping Nova forms dynamic and consistent.
BelongsTo selects (Country → State → City, Client → Project → Task) declaratively — one field class plus a dependency method — instead of hand-built Vue components. That lets a PM put "context-aware dependent selects" into an internal admin roadmap as a small, predictable line item rather than an open-ended custom-UI epic.belongsTo chains only. For that 90% case, integration is hours (declare parent, declare dependent, clear caches) versus days of custom Nova field work plus perpetual maintenance. Default to buy unless the org already owns an in-house Nova field library where this belongs.BelongsToMany, MorphTo, or non-Eloquent option sources — those remain custom scope.2.0.1 is a reliability upgrade, not a capability change. It only fixes how the field's Index/Detail/Form components are registered. Treat it as the minimum acceptable version (2.0.0 renders blank index/detail columns and throws Failed to resolve component), not as a feature milestone. Do not let it anchor a release note or a stakeholder demo narrative.Rule::exists(...)->where(parent_fk, ...) or equivalent. A PM who funds the dropdown without funding the validation rule has funded a UX nicety, not a control.Consider adoption when:
belongsTo selects in resource forms — this is precisely the problem it solves.^2.0.1, verify compatibility against your Nova/Laravel/PHP matrix, and absorb re-validation on each Nova major upgrade.make() plus one dependency method, and the dependency argument is the field attribute key, not the foreign-key column. That minute prevents a silently empty dropdown.Look elsewhere — or build in-house — when:
BelongsToMany, MorphTo, or non-Eloquent option sources. Don't bend the package; scope it as custom work.->searchable() plus an indexed foreign key; a huge option list is a bad dropdown regardless of package.One-liner for executives: This is a small, free, MIT-licensed add-on that gives our Nova admin forms proper cascading dropdowns — pick a country, the state list narrows to that country — without custom front-end development. It's an admin-only convenience, not a customer-facing system, and it carries no licensing cost.
For engineering leadership: The package extends Nova's native BelongsTo field with a dependency method, so it's declarative configuration rather than a bespoke Vue component we'd own forever. Integration is measured in hours; the ongoing cost is pinning the version, re-validating on Nova major upgrades, and keeping asset-clearing in the deploy runbook. The codebase is small enough that forking is an afternoon if maintenance lags — that's our break-glass option, and it's what makes the dependency risk manageable.
What we're explicitly not buying: It doesn't enforce data integrity — we still write the paired validation rule — and it doesn't cover many-to-many, polymorphic, or API-sourced option lists. Anything beyond a standard Eloquent belongsTo chain stays on the custom-work backlog.
What I need from the team to say yes:
^2.0.1 and verify the installed constraint — 2.0.0 has a component-registration defect.Risk statement, stated plainly: small community package, last release Feb 2023, no vendor support. Acceptable for internal admin surfaces with a named owner and a documented fallback; not acceptable as a load-bearing dependency in a customer-facing or SLA-bound workflow.
How can I help you explore Laravel packages today?