Laravel Fact — Database transaction automatically do rolling-back or committing

In Laravel, you can run a set of operations within a database transaction using the transaction method on DB facade.

  • If there is an exception or a failure thrown out, the transaction will rollback.
  • If the transaction is successful, it will commit right away.

All are done automatically, so you don’t need to worry about doing those tasks manually. However, if you prefer, you can still do it manually.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.