How do I specify an IN clause in laravel backpack?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 17:16:07

问题


How do I add an IN clause in laravel with backpack?

This is what I am looking for:

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

Should translate into something like this:

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

回答1:


Just use whereIn instead of where, backpack-for-laravel is ready for that:

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



回答2:


select * from customer whereIn (customer_id ,$array);



来源:https://stackoverflow.com/questions/52816364/how-do-i-specify-an-in-clause-in-laravel-backpack

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!