Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

laravel transactions

DB::beginTransaction();

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

    DB::commit();
    // all good
} catch (Exception $e) {
    DB::rollback();
    // something went wrong
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #laravel #transactions
ADD COMMENT
Topic
Name
1+3 =