Simple Livewire toggle switch

Tech Stack: bootstrap-5, livewire

Demo

Name Email Active
Elfrieda Runolfsdottir cletus95@example.com
Mrs. Phoebe Hodkiewicz III robyn.stoltenberg@example.net
Baby Von nicklaus62@example.net
Kenneth Hoppe Sr. qgoldner@example.com
Susana Macejkovic jessyca.morar@example.com
Antonina Heidenreich bud.carroll@example.org
Gino Cummings amaya.nienow@example.net
Rosalind Schaefer maudie.watsica@example.com
Dr. Lemuel Krajcik henderson23@example.org
Dr. Reese Predovic merlin.stoltenberg@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.