Simple Livewire toggle switch

Tech Stack: bootstrap-5, livewire

Demo

Name Email Active
Ms. Delta Olson Sr. wuckert.dennis@example.com
Ms. Arielle Kovacek clinton.lemke@example.com
Nathen Greenfelder efrain.steuber@example.com
Colton Mertz faye82@example.org
Greg Ullrich zlubowitz@example.org
Ms. Rubie Reichert MD igerhold@example.net
Dr. Myles Lynch wiegand.mireille@example.org
Dr. Will Mann salvador84@example.org
Prof. Kristoffer Gorczany PhD gleason.michael@example.org
Pattie Frami II vzulauf@example.com

Code
Download

Sorry, this component's code is restricted
Get Livewiredemos-Pro
Sorry, this component's code is restricted
Get Livewiredemos-Pro

Usage


      @livewire('toggle-switch', [
                'model' => $user,
                'field' => 'active'
                ]);
    

Documentation

This is a toggle-switch livewire component using bootstrap-5 which alters the boolean field in the database.

This is a reusable component and accepts two fields when you initialize the component Model for which you want to alter the database field and the database field name.

When the user alters the toggle switch on the front end it triggers the updating lifecycle event of the component and it changes the boolean value in the database.