У меня есть score
поле в таблице нарушений. И у меня много флажков. Когда я проверял чечбоксы, общее количество баллов собирается с помощью ajax.
<div class="panel-body">
<div class="table-responsive">
<table class="table table-bordered">
@foreach($infractions as $infraction)
<tr>
<th>{{ $infraction->title }}</th>
<td>
<input type="checkbox" data-toggle="toggle" data-on="Yes" data-off="No" data-onstyle="success" data-offstyle="danger" data-score="{{ $infraction->score }}" onClick="updateTotal();">
</td>
</tr>
@endforeach
</table>
</div>
<div class="text-right">Total:
<span id="total">
</span>
</div>
</div>
Ajax
function scorePlus (id)
{
var total = id + id;
document.getElementById('total').value = total;
}