Saturday, 14 September 2013

Looping in laravel 4

Looping in laravel 4

How can i properly loop this
If i tick one checkbox, it works properly, but if i tick more than 1, not
even one will be updated.
Controller
if (Input::has('orderIds'))
{
Order::whereIn('id',
Input::get('orderIds'))->update(array('top_up_id' =>
$topUp->id));
}
javascript
$('#top-up-pending-payment-table tbody
input:checkbox:checked').each(function(){
orderIdsHtml += '<input type="hidden" name="orderIds[]" value="' +
$(this).data('id') + '">';
});

No comments:

Post a Comment