As the title says, how do I join on a null condition in Laravel? Take the following query:
SELECT * FROM TABLE1 a
INNER JOIN TABLE2 b
ON a.col1 = b.col1
OR a.col2 IS NULL
I've tried this but not the result I wanted:
$query = Table1::join('table2', function($join){
$join->on('table1.col1', '=', 'table2.col1');
$join->on('table1.col2', ????????);
});
Thanks.