Alternative is DB::raw.
Since your advanced WHERE includes a possibility of a null, you can coalesce it to a value. Assuming '123'..
.. $join->on('A.id', '=', 'B.a_id') ->orWhere(DB::raw('COALESCE(A.b_stuff,"123")','=','123');
Or maybe reconsider how you join?
Thanks. Never heard talk about COALESCE. It solve my problem.
But because, I want to go futher if I need, is there a way to make more complex join or not?
@Xum thanks. But the complex part is a bit too simple. Like I say in my example, I have tried, but nobody has able to give me a solution to my example. Except by changing it to something simpler (so it's solve my issue but it doesn't answer to my question) .
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community