Support the ongoing development of Laravel.io →
Database Eloquent
Last updated 3 months ago.
0

Hello, the only way in found is to make like this :

$users = User::select('users.firstname', 'users.lastname', 'horaires.jour', 'horaires.start', 'classes.code as code_classe', 'classes.classe', 'cours.code as code_cour', 'cours.cour')
			->rightJoin('horaires', function($join) {
				$join->on('horaires.user_id', '=', 'users.id');
			})
			->leftJoin('classes', function($join2) {
				$join2->on('horaires.classe_id', '=', 'classes.id');
			})
			->leftJoin('cours', function($join3) {
				$join3->on('horaires.cour_id', '=', 'cours.id');
			})
			 ->get();

What is the equivalent with belongsto and other eloquent method ?

Thanks

Last updated 7 years ago.
0

Sign in to participate in this thread!

LoadForge

Your banner here too?

visualight visualight visualight Joined 30 Dec 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2022 Laravel.io - All rights reserved.