In a contact management system, I have a list of items which have a checkbox each (gmail style) so that I can select them and use some action related to the selected ones. What is the best way to save these selected items to each page accessed?
One of the Controllers that lists the items:
$request = DB::table('contatos')
->select('*')
->paginate(15);
return view('list')
->with('request', $request);
And View :
<table>
<tr>
<th><input type="checkbox" id="seleciona_todos" /></th>
<th>Nome</th>
<th>E-mail</th>
</tr>
@foreach($r as $p)
<tr>
<td><input type="checkbox" value="{{ $p->id }}" /></td>
<td>{{ $p->nome }}</td>
<td>{{ $p->email }}</td>
</tr>
@endforeach
</table>
{!! $r->appends(Input::except('page'))->links(); !!}
- Has pagination
- I use Laravel
- You will have other admin user accounts moving at the same time
I've thought of doing an ajax for a php file that writes and deletes items from an array in a session or even uses a table in the database to save the currently selected items (but will have other users currently picking and guessing that this was not going to work). What is the best way to resolve this?