用雄辩的laravel比较两个桌子上的两个殖民者 [英] Compare two colonne for some table with eloquent laravel

查看:34
本文介绍了用雄辩的laravel比较两个桌子上的两个殖民者的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Laravel中使用Eloquent ORM比较同一张表的两列.

I want to compare two column for the same table Using Eloquent ORM in Laravel.

Cadeau::where('user_theme_id','=',$liste_id)->where('current_user_id', '=', 'user_id');

current_user_id和user_id是cadeau表的拖曳列

current_user_id and user_id are the tow column of cadeau table

推荐答案

使用WhereRaw执行原始where查询

Use WhereRaw to execute a raw where query

Cadeau::where('user_theme_id','=',$liste_id)
       ->whereRaw('current_user_id = user_id')->get();

这篇关于用雄辩的laravel比较两个桌子上的两个殖民者的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆