I have three tables that are the following users, mapas, marcadores
A user has several mapas
a mapa has several marcadores
What I'm trying to do is show the marcadores that belong to the mapas of the user who has logged in.
this are the tables and relationship
This is the function in the controller that I am working on:
public function index()
{
$mapas = Mapa::orderBy('id', 'DESC')->where('user_id', auth()->user()->id);
$marcadores = Marcador::orderBy('id', 'DESC')->where('mapa_id');
return view('user.marcadores.index', compact('marcadores'));
}
thanks for your help