Support the ongoing development of Laravel.io →
Database Eloquent
Last updated 2 years 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 9 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

visualight visualight Joined 30 Dec 2014

Moderators

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

Your logo here?

Laravel.io

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

© 2024 Laravel.io - All rights reserved.