I know that handling paging with a single parameter, I can handle it with a simple appends, like this.
public function bestado(Request $request)
{
$valorestado = $request->valorestado;
$consultarea=usuarios::where('estado', $valorestado)->paginate(6);
$consultarea->appends(['valorestado'=>$valorestado]);
$usuariosOpciones=usuarios::pluck('usuario_ad', 'user_id')->unique();
return view('usuario.consultareas',compact('consultarea','usuariosOpciones'));
}
But if I want to handle the paging with a date by range, there would be two parameters, if I try to handle it with append, as for example, it does not work.
public function fecha(Request $request)
{
$valoruno=$request->from;
$valordos=$request->to;
$usuarios=usuarios::whereBetween('created_at', [$valoruno, $valordos])->paginate(10);
$usuarios->appends(['valoruno'=>$valoruno, 'valordos'=>$valordos]);
$usuariosOpciones=usuarios::pluck('usuario_ad', 'user_id')->unique();
return view('usuario.index',compact('usuarios','usuariosOpciones'));
}
How can I handle paging with a range of dates?