Giter Site home page Giter Site logo

Comments (3)

raftx24 avatar raftx24 commented on July 28, 2024

Can you give your test script? how do you update your model?

from versioning.

panadol007 avatar panadol007 commented on July 28, 2024

Hi Raftx24,

Thank you for your reply.
In my scenario, to be precise:
1 User has multiple Companies
1 Company has multiple Accounts
ALSO 1 Company has multiple Users

The update process is:
while ($outstanding > 0) {
$oldestTopup = $this->topups()->where('balanceamount', '>', 0)->orderBy('created_at')->first();
if (is_null($oldestTopup))
return false;

        if ($oldestTopup->balanceamount >= $outstanding) {
            // Log::info("Enough balance to deduct");
            $oldestTopup->balanceamount -= $outstanding; 
            $outstanding = 0;
        }
        else {
            $outstanding -= $oldestTopup->balanceamount; 
            $oldestTopup->balanceamount = 0;
        }
        $oldestTopup->save();
    }

I implemented versioning trait in Account model
But when try to implement versioning trait in Company model, it produce error saying no relationship between \App\versionings and \App\Company

from versioning.

raftx24 avatar raftx24 commented on July 28, 2024
  • For the race condition problem, you need to use lockForUpdate or something similar(you can look at pessimistic-locking) because this package cannot control concurrency in this way!
  • For the second issue, please give me the classes(with relation methods) and exception trace

from versioning.

Related Issues (13)

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.