Simple Livewire toggle switch

Tech Stack: bootstrap-5, livewire

Demo

Name Email Active
Maya Runolfsdottir billie.nikolaus@example.com
Eleazar West melany.dicki@example.net
Earl Cartwright shirthe@example.com
Hank Gibson MD zulauf.stephon@example.org
Prof. Kenna Schiller fskiles@example.org
Mrs. Claudia Conn Sr. batz.lenna@example.org
Isom Ratke DDS runolfsdottir.elody@example.org
Cassandre Christiansen lgusikowski@example.com
Ms. Elouise Runte claud68@example.net
Prof. Julianne Legros V miles.lind@example.net

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.