【发布时间】:2021-01-22 04:55:20
【问题描述】:
以下是我的代码,我想从存储过程中获取数据并使用 where 子句过滤数据,但 where 或 when 不适用于 select 子句;
DB::select('exec my_stored_procedure(?,?)', [$a, $b])
-> where(// condition); //this is not working
【问题讨论】:
-
DB::select('exec my_stored_procedure(?,?)', [$a, $b])的结果是否返回查询构建器实例?因为您只能在查询生成器上使用where -
我建议您将 where 条件构建到存储过程中:)
-
我通过执行存储过程得到了数组的结果,但我想在其中添加条件。有什么方法可以在 laravel 中实现这一点? @派对环
标签: php laravel laravel-5 laravel-query-builder