laravelBatch
laravelBatch copied to clipboard
Add new where condition???
Hi. How to?? $product_model = new Product; $index = 'id'; $value = [ ['id' => 1,'count' => 5], ['id' => 2,'count' => 3], ];
Batch::update($product_model , $value, $index); i want add new condition in Product model. Product where only show_index = 1(products table column) Batch::update($product_model , $value, $index); Please help me
batch update only one condition.
$product_model = new Product;
$index = 'show_index';
$value = [
['show_index' => 1,'count' => 5],
['show_index' => 2,'count' => 3],
];
Batch::update($product_model , $value, $index);
I think he meant multiple where condition, that's what I wanted to ask anyway. Like for example I have a settings
table with user_id
, key
, and value
columns. I'd like to use user_id
and key
as the condition to update value
column
Try Batch::updateWithTwoIndex($model, $data, $index, $index2)
Whoa, why isn't this documented in the readme
@Zzombiee2361 does it work? If it does, I'll add it to the readme
Try Batch::updateWithTwoIndex($model, $data, $index, $index2)
It's working for me. But it's working for update only, if record does not exist then not creating new one