如何在laravel背包中指定IN子句?

时间:2018-10-15 12:03:42

标签: php mysql laravel backpack-for-laravel

如何在带背包的laravel中添加IN子句?

这就是我要寻找的:

$this->crud->addClause('where', 'customer_id', 'in', [1,3,5,6,7]);`

应该翻译成这样:

select * from customer where customer_id in (1,3,5,6,7);

2 个答案:

答案 0 :(得分:1)

只需使用whereIn而不是where backpack-for-laravel 即可:

$this->crud->addClause('whereIn', 'customer_id', [1,3,5,6,7]);

答案 1 :(得分:0)

从客户中选择* whereIn(customer_id,$ array);