trin4ik/nova-switcher
A Laravel Nova field that renders a boolean toggle switch for your resources, letting users flip true/false values inline with customizable on and off labels and a clean, native-looking control.
Architecture fit. trin4ik/nova-switcher is a single-purpose Laravel Nova field plugin, not an application-layer component. Structurally it is a PHP field class extending Laravel\Nova\Fields\Field plus a compiled Vue component registered via ->component(). It sits entirely inside the Nova admin presentation layer: it reads and writes one boolean attribute through Nova's standard fill/update pipeline and touches nothing else — no routes, no service providers beyond asset publishing, no migrations, no middleware, no data model. That is the best possible blast radius for a dependency, and it is also the ceiling on its value: it changes one cell's rendering in an internal admin panel.
Integration feasibility. Mechanically trivial — composer require, vendor:publish, one line in fields(). But feasibility is gated by a dependency the package does not declare loudly enough: a licensed Nova install of a compatible major. The last release (2023-11-01) lands in the Nova 4.x era. Nova custom fields are the most upgrade-fragile surface in the ecosystem because they couple to the host's Vue runtime and asset pipeline, so "compatible with Nova 4.x-era" is a claim about a moving target, not a stable contract. For any team on Nova 4 or 5 today, the core Boolean field already renders an inline index toggle, which makes the package's headline feature native and this dependency redundant.
Technical risk. High relative to the value delivered, driven almost entirely by lifecycle rather than code quality:
composer audit, which trains teams to discount audit output.Key questions.
Boolean already satisfy the requirement? (If yes, this evaluation ends here.)Recommendation: decline adoption as a dependency. Use Nova's Boolean field, or spend roughly half a day on an owned field via php artisan nova:field. Retain the source as a pattern reference only.
Stack fit. Requires Laravel + licensed Nova; it is inert without Nova. Not portable to Filament (ToggleColumn/Toggle are first-class there), Livewire, or Backpack — those stacks have their own equivalents and should use them. Within a Nova codebase the field integrates through standard extension points only: ->rules(), ->help(), ->canSee(), ->readonly(), ->onlyOnIndex(), ->sortable(), ->default(false). There are no package-specific configuration surfaces to plan around, which simplifies design but also means anything beyond a plain binary switch is our work, not theirs.
Migration path. Three options, ranked by total cost of ownership:
Boolean — zero dependency, zero maintenance, already inline-toggleable on Nova 4/5. Verify empirically on the target resource before closing the ticket.app/Nova/Fields or a private nova-components package, compile with our own Nova tooling against our installed Nova version, and drop the Composer dependency. Half a day, and the field becomes ours on every future Nova major.composer.json (e.g. "trin4ik/nova-switcher": "1.0.0") so a future composer update cannot resolve a different artifact from a dead repo. Record the license check and provenance note.If option 3 is taken anyway, treat it as a deliberate stopgap tied to a Nova upgrade milestone, not a durable choice.
Compatibility. Unverified against current Nova majors. Before any commitment, two read-only checks close most of the risk: confirm the exact FQCN in src/ and whether the component targets Vue 2 or Vue 3 and which laravel-nova build. Then wire it to one boring boolean (is_active on an internal model), flip it in the index view, reload, confirm the DB column changed, and open the console. A blank cell with console errors is the signal to stop and reimplement rather than debug an unowned artifact.
Sequencing. (1) Confirm Nova version and evaluate core Boolean first — highest-leverage, near-zero cost step. (2) If insufficient, license/provenance check on the archived repo. (3) Decide build vs. adopt before writing any resource code. (4) If adopting, pin the exact version and add an audit-ignore entry deliberately. (5) Prove out on one internal boolean behind a filter or lens. (6) Add a regression test asserting the save round-trips the boolean, so future Nova upgrades fail loudly in CI rather than silently in the UI. (7) Attach a named owner and add "regression-check switcher field" to the Nova upgrade checklist.
Data-model prerequisites. The column must be in $fillable (or unguarded) and cast to 'boolean'. Skipping the cast is the classic source of "0"-is-truthy bugs. Nullable booleans are a design mismatch — a switch is binary by construction; either default to false or use a Select for Yes/No/Unset.
Maintenance. This is the decisive cost. An archived repo transfers 100% of maintenance to us with no upstream to absorb Nova-major churn. The field will break at some future Nova upgrade and we will fix it ourselves — at which point we have effectively forked it while still carrying the dependency and its audit noise. Ownership must be explicit and named; an unowned custom field nobody remembers is exactly how admin panels break at upgrade time.
Support. None. No issue triage, no security response, no compatibility statements. If an operator reports a broken toggle, there is no vendor to escalate to and no dependents to check for known workarounds. Internally, first-line support is whoever owns the Nova upgrade checklist.
Scaling. Functionally a non-issue — the field is O(1) per rendered row and adds no queries, jobs, or services. The scaling concern is organizational: every additional Nova resource using it widens the surface that must be re-verified at each Nova major, and the marginal ergonomic benefit per resource is small. Twelve stars and zero dependents means adoption breadth is not a de-risking factor available to us.
Failure modes.
"0" evaluating truthy).Ramp-up. Effectively zero for engineers familiar with Nova — one line in fields(), one vendor:publish. The real ramp-up is organizational: establishing the ownership record, the upgrade-checklist entry, the license determination, and the regression test before the field spreads. Budget half a day for the build-your-own path versus roughly an hour to adopt plus an unbounded tail of future upgrade rework.
Bottom line for planning. Treat this as admin-tooling backlog hygiene worth hours, not a roadmap line item, and do not let it displace customer-facing work. There is no customer-facing, revenue, or data-model impact. The demand signal — 12 stars, zero dependents, archived upstream — suggests the need is already met by Nova core. Net recommendation: decline adoption, park the capability, and revisit only on explicit ops request.
How can I help you explore Laravel packages today?