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')
1.4m articles
1.4m replys
5 comments
57.0k users