Laravel Eloquent Compare Column Values

前端 未结 3 1190
耶瑟儿~
耶瑟儿~ 2020-12-16 09:41

Eloquent\'s where() seems not working when comparing two column values. How to fix it?

Sample code:

->where(\'table_1.name\', \'=\',          


        
3条回答
  •  清歌不尽
    2020-12-16 10:27

    Escaping is unnecessary in this case, you can use whereRaw():

    ->whereRaw('table_1.name = table_2.name')
    

提交回复
热议问题