问题
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