dario-binalogue/inline-boolean
Inline boolean toggle for Laravel that lets users flip true/false values straight from a table row, with no edit page or extra clicks. Lightweight, quick to wire into Filament or Livewire resources, and built for instant, minimal-setup state updates.
composer require dario-binalogue/inline-boolean. The package targets Laravel’s standard service-provider auto-discovery, so no manual registration should be required unless you have discovery disabled.README.md, then src/ and any resources/views or config/ directory that gets published. Run php artisan vendor:publish --provider="DarioBinalogue\InlineBoolean\InlineBooleanServiceProvider" (check the exact FQCN in the README — provider naming is the most common source of copy/paste errors) and inspect what lands in config/ and resources/views/vendor/ before writing any code.1.0.4...1.0.5). Treat this as a low-risk bump and confirm by reading the diff at that URL; it is almost certainly a bugfix, dependency bump, or style/typing change.is_active / published / enabled boolean column rendered as a static badge, and swap that cell for the package’s inline toggle. You get a one-click write with no full-page reload, which is the whole point of the package.model/id/field set of attributes) and let the component own the click handler.Route::patch('/admin/users/{user}/toggle/{field}', ...)->name('users.toggle'). Narrow endpoints keep authorization explicit and stop the toggle from tripping over unrelated $request->validate() rules on your full update form.$this->authorize('update', $model) (or a policy method specific to the field) inside the controller/action so a crafted request can’t flip a flag the user shouldn’t touch. This matters most for flags like is_admin, is_approved, or published.protected $casts = ['is_active' => 'boolean']; on the model. Without it, '0' from the request round-trips as a truthy string in Blade conditionals and you get a toggle that looks on when it’s off.wire:click="toggle({{ $model->id }})" action that does $model->update(['is_active' => ! $model->is_active]) and returns nothing — Livewire re-renders the single cell. If the package ships its own Livewire component, prefer it, but keep your own action as a thin wrapper so you can add audit logging.PostPublished, UserDeactivated). Toggling is a state transition with business meaning, and you will want the trail when someone asks who unpublished a page.->paginate() defaults if you don’t expose a where('is_active', true) filter alongside. Ship the filter and a “select all → bulk enable” action in the same pass, or users will click 40 toggles one at a time.$this->actingAs($admin)->patch(route('users.toggle', $user))->assertRedirect(); $this->assertDatabaseHas('users', ['id' => $user->id, 'is_active' => false]); plus a 403 case for an unprivileged user and a 419 case if you rely on session CSRF from a custom fetch call.fetch(), remember X-CSRF-TOKEN from the <meta name="csrf-token"> tag. A 419 here renders as a “toggle does nothing” bug and eats an afternoon.tinyint(1) vs Postgres boolean vs SQLite integer — comparisons differ. If you ever query where('is_active', '=', true) on SQLite you can get surprising results; rely on the model cast rather than raw SQL literals.$model->update($request->all()) is both a security hole and a source of accidental writes. Whitelist the single field: $model->update([$field => ! $model->{$field}]), and validate $field against an allow-list so the route parameter can’t be used to flip arbitrary columns.SoftDeletes, {user} binding won’t resolve trashed records — fine for most cases, but check that your restore/archive flows don’t expect toggles to work on trashed rows.vendor:publish the component views, package updates will not touch them. After bumping to 1.0.5 (and on every minor), diff the package’s original views against your published copies before assuming a rendering fix reached you.^1.0.5 rather than ^1.0, and skim the compare diff for changes under src/ that touch request validation or authorization — those are the only plausible classes of change that could affect your endpoints in a patch.vendor/, stop — wrap the package’s component in your own Blade partial instead, so a future 1.x release doesn’t overwrite your work.is_banned, is_deleted-adjacent flags), add a confirm step client-side and throttle the endpoint; the package’s job is the write, not the safety rails.How can I help you explore Laravel packages today?