Answers for "rollback laravel transaction"

PHP
5

rollback laravel transaction

DB::beginTransaction();

try {
    DB::insert(...);
    DB::insert(...);
    DB::insert(...);

    DB::commit();
    // all good
} catch (\Exception $e) {
    DB::rollback();
    // something went wrong
}
Posted by: Guest on May-19-2020

Code answers related to "rollback laravel transaction"

Browse Popular Code Answers by Language