I have the following driver:
public function show($id)
{
// Busco el perfil
$perfil = lista::where('di', $id)->first();
//con el resultado de la busqueda muestro el perfil
$mostrarperfil = Perfiles::where('id', $perfil['di'])->get();
return view('products.show', compact('mostrarperfil'));
}
This driver works well for me, but what I need is to do this but with several profiles at once, to see if I explain. I want to change this:
$perfil = lista::where('di', $id)->first();
Because of this:
$perfil = lista::where('di', $id)->get();
This would give me several results but I do not know what changes I would have to make to this to be able to show all the profiles that I throw $ profile:
$mostrarperfil = Perfiles::where('id', $perfil['di'])->get();
I hope it is understood try to do a foreach but I do not get it besides I do not know if it is the correct way ..
I am trying to do it in the following way but it still shows me only one result ..
public function show($id)
{
// Busco el perfil
$perfil = lista::where('di', $id)->get();
foreach($perfil as $perfi){
//con el resultado de la busqueda muestro el perfil
$mostrarperfil = Perfiles::where('id', $perfi->di)->get();
}
return view('products.show', compact('mostrarperfil'));
}