jeudi 12 mars 2020

How to join two tables with a pivot table using Laravel?

I have three tables and I would like to join them with models in eloquent... I have this query that it works.. but I need to work with models... How would be the models instead of this query

$asesors = DB::table('tbl_lista_contactabilidad')
            ->join('tbl_equipo_postventaatcs', 'tbl_equipo_postventaatcs.id', '=', 'tbl_lista_contactabilidad.usuarios_id')
            ->join('users', 'users.id', '=', 'tbl_equipo_postventaatcs.asesor_id')
            ->get();

I only want the relations that I should write in my models



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire