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.
composer require markrassamni/inline-boolean.Boolean::make('Active')->inlineOnIndex() instead.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'),
// ...
];
}
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.
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.->onlyOnIndex(). Keep an inline version on the detail page only if you want a single-click save without the form's Update button.->withMeta([...]) if the component supports custom on/off labels — check the Vue source before assuming.true from update() for the people who should be able to flip it; the field doesn't add its own guard beyond Nova's.InlineBoolean extends \Markrassamni\... class so you can later swap the internals for Nova 4's native inlineOnIndex() without touching every resource.Boolean filter for the same column so the index remains useful when the list grows.actingAs($user)->putJson("/nova-api/users/{$user->id}", ['is_active' => true])) rather than trying to click the Vue component end-to-end.Boolean::make('Active')->inlineOnIndex()->inlineOnDetail() does the same thing — prefer it for any new work.$casts = ['active' => 'boolean'], the model returns 0/1 strings and the toggle desyncs from the database after the first click.update() returns false, the request 403s and the checkbox snaps back. Check the network tab before assuming the component is broken.php artisan nova:publish (or your Nova asset publish command) and hard-refresh; the Vue bundle is easy to leave stale.role_user.is_primary) can't be toggled this way.sortable() on the underlying Boolean semantics; some versions lose sorting when you swap the field class.meta payload are set in the field class. Subclass it if you need to change labels, colors, or the confirmation behavior.How can I help you explore Laravel packages today?