laravel - 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);
解决方案
你可以使用这个orWhere
:
DB::table("transaction")->where("id",$get->id)->orWhere("ref_id",$get->ref_id);
谢谢..!
推荐阅读
- excel - 在空白单元格的情况下如何找到时间和提示消息之间的差异
- python - Django ORM 使用哪些运算符来访问对象中的字段?
- python - 排除字符串列表中的相似度
- flutter - Flutter:从选项卡将一些字符串传递到特定选项卡并在选项卡栏中显示该特定选项卡
- apache-kafka - Header Kafka 中的相关 ID
- java - Spring with Thymeleaf - 在 UI 中显示角色数组
- android - 如何在android中使用多部分数据发送文件
- java - 如果同一类的对象相同
- sql - 删除 SQL Server 中特定特殊字符后的所有内容
- javascript - 反应原始与构建