Coder Social home page Coder Social logo

Add new where condition??? about laravelbatch HOT 6 CLOSED

mavinoo avatar mavinoo commented on August 20, 2024
Add new where condition???

from laravelbatch.

Comments (6)

mavinoo avatar mavinoo commented on August 20, 2024

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);

from laravelbatch.

Zzombiee2361 avatar Zzombiee2361 commented on August 20, 2024

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

from laravelbatch.

WalterWoshid avatar WalterWoshid commented on August 20, 2024

Try Batch::updateWithTwoIndex($model, $data, $index, $index2)

from laravelbatch.

Zzombiee2361 avatar Zzombiee2361 commented on August 20, 2024

Whoa, why isn't this documented in the readme

from laravelbatch.

WalterWoshid avatar WalterWoshid commented on August 20, 2024

@Zzombiee2361 does it work? If it does, I'll add it to the readme

from laravelbatch.

sandeep0108 avatar sandeep0108 commented on August 20, 2024

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

from laravelbatch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.