I have a checkbox and i want to make my checkbox checked by default, if the user unchecks the checkbox and save the form, i need the checkbox to be unchecked while retrieving or editing the form data.

**My view page** 

```
<div class="form-group {{ $errors->has('active') ? 'error' : '' }}">
                <label for="active" class="col-md-3 control-label">@lang('admin/assetdetails/form.active')</label>
                     <div class="controls col-md-7">
                            {{ Form::checkbox('active', 1, Input::old('active', $assetdetail->active), array('class'=>'isnesdbox')) }}
                            {{ $errors->first('active', '<span class="alert-msg"><i class="icon-remove-sign"></i> :message</span>') }}
                     </div>
            </div>

```

**Giving this brings back the old data from database correctly but i couldn't make my checkbox checked as default**

**Controller:**

```
public function postEdit($assetdetailId = null)
    {
        // Check if the location exists
        if (is_null($assetdetail = Assetdetail::find($assetdetailId)))
        {
            // Redirect to the blogs management page
            return Redirect::to('admin/settings/assetdetails')->with('error', Lang::get('admin/assetdetails/message.does_not_exist'));
        }

        // get the POST data
        $new = Input::all();

        // attempt validation
        if ($assetdetail->validate($new))
        {

            // Update the location data

            $assetdetail ->asset_number             = e(Input::get('asset_number'));
            $assetdetail ->location_id              = e(Input::get('location_id'));
            $assetdetail ->assign_to                = e(Input::get('assign_to'));
            $assetdetail ->asset_type_id            = e(Input::get('asset_type_id'));
            $assetdetail ->nesd                     = e(Input::get('nesd'));
            $assetdetail ->active                   = e(Input::get('active'));
            $assetdetail ->shift                    = e(Input::get('shift'));
            $assetdetail ->supplier_name            = e(Input::get('supplier_name'));
            $assetdetail ->description              = e(Input::get('description'));
            $assetdetail ->dateof_purchase          = e(Input::get('dateof_purchase'));
            $assetdetail ->label_number             = e(Input::get('label_number'));
            $assetdetail ->purchase_price           = e(Input::get('purchase_price'));
            $assetdetail ->dateof_disposed          = e(Input::get('dateof_disposed'));
            $assetdetail ->depreciation_type        = e(Input::get('depreciation_type'));
            $assetdetail ->salvage_value            = e(Input::get('salvage_value'));
            $assetdetail ->asset_life               = e(Input::get('asset_life'));

            // Was the asset created?
            if($assetdetail->save())
            {
                // Redirect to the saved location page
                return Redirect::to("admin/settings/assetdetails/$assetdetailId/edit")->with('success', Lang::get('admin/assetdetails/message.update.success'));
            }
        }
        else
        {
            // failure
            $errors = $assetdetail->errors();
            return Redirect::back()->withInput()->withErrors($errors);
        }

        // Redirect to the location management page
        return Redirect::to("admin/settings/assetdetails/$assetdetailId/edit")->with('error', Lang::get('admin/assetdetails/message.update.error'));

    }

```

**I tried**

```
{{ Form::checkbox('active', 1, true, Input::old('active', $assetdetail->active), array('class'=>'isnesdbox')) }}

```

But i get the follwing error

Cannot use a scalar value as an array

**I also tried this**

```
<input class="col-md-1 controls isnesdbox" type="checkbox" name="active" checked id="active" value="1" {{ $assetdetail->active === '1' ? 'checked' : '' }} />

```

Please help me to achieve this
Note:iam using mysql database and the database type iam using is bit which stores 0's and 1's depending on the user input.
['https://Stackoverflow.com/questions/26530261', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3532653/']
Since Google apparently still thinks this answer is relevant, here's an updated answer for Laravel 5.8:

```html
<input type="checkbox" value="true" name="notify" @if(!old() || old('notify') == 'true') checked="checked" @endif />

```
For variable-based default value
--------------------------------

In below, if `$myDefault` is set to `true`, it equals checking the check-box by default.

```html
<input type="checkbox" value="myOnValue"
       name="myField"
       @if((!old() && $myDefault) || old('myField') == 'myOnValue') checked="checked" @endif />

```

Always checked by default
-------------------------

```html
<input type="checkbox" value="on"
       name="myField"
       @if(!old() || old('myField') == 'on') checked="checked" @endif />

```

Always unchecked by default
---------------------------

Below does not need "`!old()`" workaround.

```html
<input type="checkbox" value="on"
       name="myField"
       @if(old('myField') == 'on') checked="checked" @endif />

```

> 
> Related Laracast: <https://laracasts.com/discuss/channels/laravel/how-to-set-old-value-for-checkbox-input-using-blade?page=1&replyId=771230>
> 
> 
>