I load check boxes from database with they are checked or not,
<div class="row">
<div class="col-xs-12">
<div class="form-group">
@php
$json = $orders->data;
$json = json_decode($json, true);
$products = $json['order_info']['products'];
$data = '';
foreach ($products as $hitsIndex => $hitsValue) {
$data .= $hitsValue['type']. ', ';
}
$data = rtrim($data, ', ');
$agosProducts = Utility::constant('agos_products1');
@endphp
<label for="products" class="control-label"></label><br><br>
@foreach($agosProducts as $product)
<label class="control-label "for="">
<input id="" name="" type="checkbox" value=""
@foreach ($products as $hitsIndex => $hitsValue)
@if(in_array($hitsValue['type'], $product)) checked=checked @endif
@endforeach
>
</label>
<br>
@endforeach
</div>
</div>
</div
Now i want to update my database base on checkbox value.
For example if say i load checkbox 1 as checked from database and now it's unchecked i need to update it in database.
This code i can get all the current status of checkbox but i don't know previous values of this to update in database,
$chks = array('multicolor','resizable','showRuler','namesNumbersEnabled');
foreach ($chks as $chk) {
$product->setAttribute($chk, (Input::has($chk)) ? true : false);
}
Can someone helps me?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire