首页 > 解决方案 > DB::table 中的 OR 语句?

问题描述

我怎样才能应用这个条件

$where =  "id={$get->id} or ref_id={$get->ref_id}";

到 DB::table ?

也许像

 DB::table("transaction")->where("id",$get->id)->or("ref_id",$get->ref_id);

标签: laravel

解决方案


你可以使用这个orWhere

 DB::table("transaction")->where("id",$get->id)->orWhere("ref_id",$get->ref_id);

谢谢..!


推荐阅读