I'm not well experienced but it should works.
$join->on(DB::raw('a.field3 = c.field3'), DB::raw(''), DB::raw(''));
I think you need to check Eloquent: Relationships .
@saurabhd, it's not working. if the query in debug, the result : LEFT JOIN table3
AS c
ON a
.field2
= c
.field2
AND a
.field3= c
.field3
= ``
No worries! Let's make it simple:
$join->on('a.field3', '=', 'c.field3');
I found the similar solution from blog but I don't why the first answer not working.
your original post should work. have you tried https://github.com/barryvdh/laravel-debugbar. it's a nice sql profile. you can check the sql query running against your database to see if matches your expectation.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community