Level 1
Anyone can guide me? Many many thanks.
I try to implement using answer in the link above but seems not working. I am unable to keep the checkbox values with pagination. There is a form after collecting all checkbox, then only post the form together with checkbox. My code as follows:
View:
{{ Form::open(array('url' => ('postToAnotherForm'), 'class'=>'form-horizontal')) }}
<div class="table-responsive">
<table class="table table-bordered table-striped">
<tr>
<th>Checkbox</th>
</tr>
@foreach($items as $item)
<tr>
<td>{{ Form::checkbox('abc[]', $item->id) }}</td>
</tr>
@endforeach
</table>
</div>
<div class="paginate">
{{ $items->appends(Input::except('page'))->links() }}
</div>
{{ Form::submit('Next', array('class'=>'btn btn-primary pull-right')) }}
{{ Form::close() }}
Controller:
$items= Item::paginate(2);
$checked_items = [];
if (Session::has('checked_items'))
$checked_items = Session::get('checked_items');
$checked_items = array_merge($checked_items, Input::get('abc'));
Session::flash('checked_items', $checked_items);
return View::make('form', compact('items'))->withInput($checked_items);
Anyone has any idea? Thanks for giving some idea.
Please or to participate in this conversation.