I have a function in my controller that receives some requests, and in the end everything is stored in two arrays. In this function, if I do the following:
return view('negocio.detalhes-trajetoa', compact('arrayLogradourosA', 'arrayLogradourosB'));
I can access these two arrays in this view.
But my goal is to pass these two arrays to another function of my controller, to look like this:
public function outraFuncao () {
return view('negocio.detalhes-trajetoa', compact('arrayLogradourosA', 'arrayLogradourosB'));
}
But as these two arrays are in another function of my controller, in my view it gives that error "Undefined variable".
How can I share these two arrays for another function in my controller ??