Answers for "laravel transaction with models"

PHP
6

laravel transactions

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 "laravel transaction with models"

Browse Popular Code Answers by Language