smart145/inline-boolean
A lightweight Laravel package for inline boolean toggles: flip true/false attributes right from list tables and admin views, with a single click and no full form submission. Easy to wire into Blade or Livewire and simple to customize.
Architecture fit. The package is best understood as a UI interaction pattern, not an infrastructure dependency. It adds a single-purpose control — flip a boolean without a page reload — into an admin surface. The public description advertises a Blade component with a small JavaScript layer posting to a configurable endpoint; the deeper technical notes describe a Nova field class extending Laravel\Nova\Fields\Boolean with a prebuilt Vue bundle in dist/. That divergence is the first thing to resolve: it determines whether this fits a Blade/vanilla-JS admin or a Nova admin, and those are different integration stories with different risk profiles. If you are not on Nova, the field-class path is irrelevant and the Blade framing needs verification against source, since no source excerpt here confirms a Blade component exists.
Integration feasibility. In the narrow case it targets — Nova 3-era stack (Laravel ~6–8, PHP 7.2–8.0), a moderation or visibility toggle, a throwaway container — integration is genuinely a one-liner plus a policy test. Outside that case it is not feasible without forking. There is no service provider, no config file, no migration, no extension surface beyond subclassing. The practical feasibility question is therefore not "can we install it" but "can we afford to own it," and the answer is yes only if we vendor the source into our own package directory.
Technical risk. Three risks dominate, in order:
authorizedToUpdate. A list-view control that writes without policy enforcement is a permissions hole, not a UX feature. This must be confirmed before any other evaluation continues.true/false. Composer constraints from that era will also hard-fail resolution on PHP 8.2+. --ignore-platform-reqs is not a workaround; a wrong constraint implies a wrong bundle.Secondary risks: no validation on the inline path (rules and required don't run), no events emitted so dependent fields and metrics go stale, no concurrency handling between two admins, and no audit trail unless we add one.
Key questions.
Stack fit. Only fits a Nova 3-era application on Laravel 6–8 / PHP 7.2–8.0. On anything newer, treat the package as a reference implementation whose pattern we replicate, not a dependency we install. The Blade claim in the description should be verified before it is used to justify a non-Nova integration.
Migration path. There is no migration path in the upgrade sense — there is a fork path. Two viable options:
php artisan nova:field in-house, copy the field class, write our own Vue component against laravel-nova's field mixin, and point it at Nova's built-in field-update endpoint. Roughly 1–2 engineer-days, and we own the Nova 4/5 upgrade rather than inheriting a dead one.nova-components/ package, pin by commit SHA (never a floating version), and record the targeted Nova major in the repo README.Either way, "install and forget" is off the table.
Compatibility. Confirm against source, not the README: the laravel/nova, php, and laravel/framework constraints in composer.json; the registered component name inside dist/js/field.js; and the exact label/color/state API on the field class. Do not assume method names from the description.
Sequencing.
PUT /nova-api/{resource}/{id}/field/{field}. Anything else is a no-go pending fork.update permission gets 403 and the record is unchanged. Run it even for a spike.inlineFlag() helper or trait so every quick-toggle behaves identically across resources.Maintenance. We become the maintainer the moment it lands. No CI, no changelog, no security advisories, no issue triage, zero stars, zero dependents, one release in April 2020. Budget a mandatory re-review at every Nova major upgrade and record the pinned commit. This is the single largest recurring cost and it should be stated plainly in any adoption decision.
Support. No upstream support path exists. Internal support means whoever forked it. That argues strongly for the in-house nova-components/ copy — debugging our own readable, rebuildable component is materially cheaper than debugging a prebuilt dist/ bundle with no reproducible build step. Log inline writes explicitly (Log::info or an observer) so we can answer "who flipped this and when" during an incident; Nova's update events do not cover every field-update path uniformly across versions.
Scaling. The mechanism scales fine technically (one small request per click), but two behavioral limits matter operationally: rapid clicking causes write amplification (add an in-flight disabled guard), and concurrent admins diverge silently because there is no realtime channel — the second admin's view only corrects on reload. On the organizational side, the real scaling win is standardization: one toggle behavior, one authorization model, one set of guards across resources, rather than six bespoke implementations drifting between teams.
Failure modes.
| Failure | Symptom | Mitigation |
|---|---|---|
| Component never mounts (Vue 2 bundle on Nova 4+) | Empty cell or raw true/false, sometimes no console error |
Vendor/rebuild; check for "Unknown custom element" |
| Silent rejection | Toggle looks green, server value unchanged | Negative-permission test; verify rollback; ensure next load shows server truth |
| Authorization bypass | Toggle writes without policy check | Disqualifying — fork or do not ship |
| No validation on inline path | Invariant violated (e.g. unpublish an invoiced record) | Enforce in model observer or policy method, not in form rules |
| Stale dependent state | published set without published_at; metrics don't refresh |
Handle side effects in a saving hook/observer so all write paths fire |
| Stale dashboards | Metrics read caches that the inline write didn't invalidate | Observer-driven invalidation or refresh on index load |
| No audit trail | Cannot reconstruct who changed a flag | Explicit logging at the write path |
Ramp-up. Low for a competent Laravel/Nova engineer — the interaction model is obvious and the code surface is small. The ramp-up cost is not learning the package, it's learning that there is no safety net. The four-question debug checklist (field present in fields() for this request? component name resolved in console? request hitting /nova-api/.../field/...? policy true for this user and this model?) isolates almost any failure in about ten minutes. The heavier ramp-up is on the product side: classifying which booleans are safe for a one-click write, deciding the audit-logging and confirmation policy, and setting the org's precedent for adopting unmaintained dependencies. That classification work is the actual deliverable — the package is just the cheap prototype that informs it.
How can I help you explore Laravel packages today?