Laravel Controller ignore if request true or false

Solution:

First, die and dump you request to make sure you are getting an input when the box is checked:

dd($request->all());

HTML checkboxes are a tricky beast. Basically, if they are checked, they will send a value in the request, otherwise, they will not. By default a checkbox sends the value of ‘on’ when checked though you can modify this to any value you like, like so:

<input type="checkbox" name="active" value="1"/>

Again, if they are not checked, it WILL NOT appear in your request.

In your controller, you may check if the box is checked/input exists by simply doing the following:

if(!$request->active) {
    //code if unchecked
} else {
    //code if checked
}

This executes specific code depending on if the checkbox is checked or not.