inspheric/nova-defaultable
Nova Defaultable lets Laravel Nova fields and resource forms start with sensible prefilled values, reducing repetitive data entry. Configure defaults once and streamline create workflows across your Nova admin panels.
status = draft, owner = current user, publish_at = now + 1 day — so operators stop retyping the same boilerplate on every record. The decision it informs: is shortening time-to-create for core admin records worth engineering time this quarter, and which fields should never be blank? v1.2 extends the same mechanism into resource action modals, which changes the answer for confirmation-style flows: "Assign to…", "Duplicate as draft", and "Move to status" can open on the intended value so an operator confirms in one click instead of filling a form.app/Nova/Concerns/, or skip it and use ->withMeta(['value' => ...]) alongside model $attributes and database defaults. Frame it as "a few days of admin polish" rather than a platform dependency, and budget accordingly.draft but the "Move to status" action defaults to published. Decide deliberately whether defaults are centralized in a defaults() helper on the resource, in model $attributes, or in migrations, and make that the reviewable convention.Consider it — as an accelerant, pattern reference, or internal-only utility — when:
defaultLast() as a design idea (fallback-only semantics). The release notes flag it as carrying a caveat/workaround, so treat it as something to inspect and test, never as behavior to depend on.Look elsewhere — or implement in-house — when:
--ignore-platform-reqs in CI.$attributes must still carry the business rule.default() / defaultLast() with withMeta(['value' => ...]), resolveUsing(), or fillUsing(). Last writer wins — pick one convention per field instead of hoping precedence resolves in your favor.To executives: This is a small, MIT-licensed add-on for the internal admin tool that pre-fills new-record forms and action dialogs with the values we already know — the default status, the assigned owner, the effective date. It removes repetitive typing from high-frequency operator workflows, which reduces data-entry errors and speeds up record creation, and the latest version extends that to the one-click action flows our support team lives in. It is not a platform bet: the capability is a few hundred lines of code, so we can adopt it, copy it in-house, or replace it outright at negligible cost. The decision I need is whether admin ergonomics is worth a small, time-boxed backlog item this cycle — not whether to take on a vendor.
To engineering: Treat this as a convenience we own, not a dependency we rely on. It is a single trait plus a service provider, last meaningfully released in 2019 with a v1.2 that added action support; 51 stars, zero dependents, sporadic cadence. Pin ^1.2 (older constraints silently skip action defaults), read the vendored trait source rather than the README to confirm the method names and precedence your installed version actually exposes, and plan the exit up front: copy the trait into app/Nova/Concerns/Defaultable.php with identical call sites, or drop it for withMeta(['value' => ...]) plus model-level $attributes. Keep one source of truth for defaults across create forms and action modals, allow exactly one of default()/defaultLast() per field as a code-review rule, keep real database defaults for anything created outside Nova, and cover three test cases — new resource, existing resource, action modal — so we catch "defaults leaked into edit" and "modal opened blank" regressions before operators do.
How can I help you explore Laravel packages today?