I have a problem with the controller, I'm looking for a product and at the same time I'm looking for a product that I have related up to here I have no problem using this driver:
public function show($id)
{
$producto = Producto::find($id);
$relacionado = relaciones::where('idrelacion', $id)->find();
return view('products.show', compact('producto', 'relacionado'));
}
But when I try to look up the related product in the base table it gives me the following error error: Property [kinship_id] does not exist on this collection instance. "but in the table relations if there is kinship_id" This is the controller I use:
public function show($id)
{
$producto = Producto::find($id);
$relacionado = relaciones::where('idrelacion', $id)->find();
$productorecomendado = Producto::where('id', $relacionado->producto_id)-->find();
return view('products.show', compact('producto', 'productorecomendado'));
}
As you can see what I'm trying to do is to look again in the table for products with the id that the related variable throws at me but I do not get it ..