Answer the question
In order to leave comments, you need to log in
Laravel start transaction and end in different places?
Hello! There are two services, ServiceOne and ServiceTwo. Both are singletons.
From the controller, I pull $injectedServiceTwo->someMethod([1, 2, 3, 4]), in which I need to do some actions and reach the transaction. At the same time, it is important that one of the transaction requests be in ServiceOne, since it is he who is responsible for that request.
How to implement it correctly?
There is an option with DB::beginTransaction(), DB::commit() - but this will add a bunch of extra try catch, and somehow it's not right.
Can there be something better than this? Thanks in advance!
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question