Simple Livewire toggle switch

Tech Stack: bootstrap-5, livewire

Demo

Name Email Active
Kim Howe shanny50@example.org
Dr. Geovanny Pfeffer josue.wintheiser@example.net
Jameson Auer rhammes@example.com
Mrs. Jaqueline Rutherford MD xbaumbach@example.org
Tremaine D'Amore turner72@example.org
Dr. Adonis Wunsch Sr. weldon43@example.org
Dr. Georgianna Auer III tillman.michaela@example.com
Jennifer Predovic pschamberger@example.net
Wilhelmine Abbott alexie.walter@example.net
Maxime Kutch marian31@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.