Eloquent's where() seems not working when comparing two column values. How to fix it?
where()
Sample code:
->where('table_1.name', '=', 'table_2.name')
But works on:
->where('table_1.name', '=', 'john')
Escaping is unnecessary in this case, you can use whereRaw():
whereRaw()
->whereRaw('table_1.name = table_2.name')
2.1m questions
2.1m answers
60 comments
57.0k users