1
I have a client page with a button that enables or disables a customer from that list. However if I am on Pag=4 (for example), when active or Deactivate the client I go back to the home page and lose the pagination where I was. Is it possible to post and return the same page? Below is the code of the Controller:
public function alterarStatus(Request $request) {
if ($request->ativar) {
$clientes = ClientesRepository::ativarCliente($request->id);
return redirect()->route('admin.clientes')->with('success', 'Cliente ativado com sucesso');
}
$clientes = ClientesRepository::desativarCliente($request->id);
return redirect()->route('admin.clientes')->with('success', 'Cliente desativado com sucesso');
}
The route 'admin.clients' return the following:
public function clientes() {
$email = null;
$nome = null;
$cidade = null;
$estado = null;
$quantidadePorPagina = 10;
$clientes = ClientesRepository::clientesLista($quantidadePorPagina);
return view('admin.clientes.clientes', compact('clientes', 'email', 'nome', 'cidade', 'estado'));
}
This method worked, however I ended up sending in the formulated the $_GET['page'] and returning the same on the route:
– Betini O. Heleno
Perfect. Very well!
– R. Pêgo