Does Laravel observer needs its own DB transactions?


I have a pretty big system that use observer to update my database. My question is, does the observer needs its own db transaction? Or will it use the same transaction in the controller that trigger the events?

I had very rare issues with deadlock. The direct deadlock solution is to just include reattempt argument in the DB::transaction method. But the deadlock happens in my observer (which i didn’t use db transaction in it) instead of the controller function.

Source: Laravel

Categorised as laravel Tagged


Leave a Reply

Still Have Questions?

Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us