Wire:change is not working on Checkbox

It’s my first experience working with Livewire and the experience has been amazing. I want to work with some toggling via checkboxes but wire:change doesn’t seem to work on checkbox.

I’m using the latest version of Laravel Livewire.
<div class="form-group"> <label class="col-sm-2 control-label">Post As Admin?</label> <div class="col-sm-10"> <label> <input type="checkbox" wire:change="selectUser(1)"> <i></i> </label> </div> </div>

I’m using the same function sleectUser on a button click and it is working just fine. Tried to do it on a checkbox change and it doesn’t work. Sorry IDK why the indentation is not working.

I don’t think wire:change is a valid livewire directive. I could be mistaken, though. However, you can accomplish this by monitoring the update lifecycle of your model.


<input wire:model="userSelect" type="checkbox">

public function updatedUserSelect()
    // code to execute

You can find more hooks in the lifecycle to play around with here:

There might be a more appropriate place for your code to execute but I’m unsure of the full scope of your code.