Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Inline Boolean Laravel Package

markrassamni/inline-boolean

A Laravel Nova field for toggling boolean values directly from resource index and detail views. It provides a compact inline switch, customizable on/off labels, and quick updates without opening a separate edit form. Useful for publishing, enabling, or approving records in one click.

View on GitHub
Deep Wiki
Context7

Getting Started

  1. Install the field: composer require markrassamni/inline-boolean.
  2. Verify compatibility first. The last release was June 2019, which predates Nova 3 and 4. Confirm the Vue component compiles against your Nova version before building on it — if you're on Nova 4+, stop here and use the native Boolean::make('Active')->inlineOnIndex() instead.
  3. Import the field in the resource that needs it and swap your existing Boolean::make(...) for it (namespace per the package README):
use Markrassamni\InlineBoolean\InlineBoolean;

public function fields(Request $request)
{
    return [
        ID::make()->sortable(),
        InlineBoolean::make('Active'),
        // ...
    ];
}
  1. First use case: toggling an is_active / is_featured flag straight from the resource index instead of opening the detail page and hitting Save. Make sure the model casts it (protected $casts = ['is_active' => 'boolean'];) and the migration gives it a default.

Where to look first: the field class in src/ and its Vue component in resources/js/. That's where the AJAX endpoint, CSRF handling, and any meta values it reads are defined — everything you'll debug later lives there.

Implementation Patterns

  • Field swap: replace Boolean::make() only on fields you actually want inline. Leave audit-style booleans (is_verified, is_banned) as read-only detail fields so accidental clicks can't change them.
  • Index vs. detail: most usage is ->onlyOnIndex(). Keep an inline version on the detail page only if you want a single-click save without the form's Update button.
  • Labeling: use native field methods for display text and ->withMeta([...]) if the component supports custom on/off labels — check the Vue source before assuming.
  • Authorization: treat the toggle as an update operation. Ensure the resource policy returns true from update() for the people who should be able to flip it; the field doesn't add its own guard beyond Nova's.
  • Wrap it: if you're stuck on an older Nova, wrap the field in your own InlineBoolean extends \Markrassamni\... class so you can later swap the internals for Nova 4's native inlineOnIndex() without touching every resource.
  • Pair with a filter: add a Boolean filter for the same column so the index remains useful when the list grows.
  • Testing: assert the underlying endpoint updates the column (actingAs($user)->putJson("/nova-api/users/{$user->id}", ['is_active' => true])) rather than trying to click the Vue component end-to-end.

Gotchas and Tips

  • Archived and unmaintained. No fixes, no Nova 3/4 support, no security patches. On Nova 4+ the native Boolean::make('Active')->inlineOnIndex()->inlineOnDetail() does the same thing — prefer it for any new work.
  • Missing boolean cast is the #1 bug. Without $casts = ['active' => 'boolean'], the model returns 0/1 strings and the toggle desyncs from the database after the first click.
  • Policy failures look like silent no-ops. If update() returns false, the request 403s and the checkbox snaps back. Check the network tab before assuming the component is broken.
  • 419 / CSRF errors mean the component isn't picking up the meta tag from the Nova layout — usually a stale compiled asset.
  • Re-publish after installing: run php artisan nova:publish (or your Nova asset publish command) and hard-refresh; the Vue bundle is easy to leave stale.
  • Pivot booleans won't work. The field updates the resource's own table, so a boolean living on a pivot (e.g. role_user.is_primary) can't be toggled this way.
  • Sortable columns: make sure the column is still sortable() on the underlying Boolean semantics; some versions lose sorting when you swap the field class.
  • Extension point: the component name and meta payload are set in the field class. Subclass it if you need to change labels, colors, or the confirmation behavior.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings
coleus/apps
seampact/laravel
emmyconceptng/laravel-ng-postcode
jjsquady/round-robin
skyraptor/chatter
edlugz/sasapay
abbasudo/artisan-route