I have made a CRUD with the typical views of create, edit, index and show. In the index view I have defined a field to perform a filter that works correctly. What I would like to know is how to maintain the initial filter of the index view when returning, for example, from the edit view once a record has been modified.
Currently what I do in the driver for the edition is:
public function update(bancoRequest $request, $id)
{
$banco = banco::find($id);
$banco->fill($request->all());
if ($banco->isDirty())
{
$banco->flag_inactivado = $request->has('flag_inactivado') ? 1 : 0;
$banco->save();
flash::success('El banco <b>'.$banco->getCodigoBanco() . ' '. $banco->nombre .'</b> ha sido modificado con éxito.')->important();
}
else
{
flash::success('Sin cambios que registrar.');
}
return redirect()->route('bancos.index');
}
but when redirecting to the index view again all records are shown again and I want to show only the ones initially filtered before clicking the edit button of the updated record.