【发布时间】:2019-11-07 19:06:13
【问题描述】:
我是 Laravel 的新手。 如何将以下查询转换为 Laravel 的 where 子句。
where category='1' and (shipping_from='1' OR shipping_to='2')
【问题讨论】:
-
->where('category', 1)->where(function($q){ $q->where('shipping_from', 1)->orWhere('shipping_to', 2)});以获得更好的视图查看此链接laravel.com/docs/5.6/queries#parameter-grouping