In reference to this point: https://www.php.net/manual/en/pdo.begintransaction.php#109753
The following code works, but can it be run safely on production?
DB::beginTransaction();
try {
// update statements
DB::transaction(function(){
// update statements
});
// update statements
DB::commit();
} catch (Exception $e) {
DB::rollback();
}
Yes, it helps maintain the atomic state either the data gets stored or rollback.