jere rosas
jere rosas

Reputation: 111

checkbox - leave checked - laravel

I need my checkbox to be marked if the variable is not empty, if the variable is empty it remains unchecked

<div class="n-chk">
    <label class="new-control new-checkbox new-checkbox-rounded checkbox-primary">
        <input name="reingresado" checked="{{$variable->actived}}" type="checkbox" class="new-control-input">
        <span class="new-control-indicator"></span>¿Producto Reingresado?
    </label>
</div>

Upvotes: 0

Views: 53

Answers (1)

John Lobo
John Lobo

Reputation: 15319

You can do like below.Here i assume reingresado value is 1

 <input name="reingresado"  type="checkbox" class="new-control-input"  {{(isset($variable->actived)&&$variable->actived==1)?"checked":""}}>

Upvotes: 2

Related Questions