Answers for "laravel eloquent transactions"

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
0

laravel transactions eloquent

DB::transaction(function() {
      //
});
Posted by: Guest on August-08-2021

Code answers related to "laravel eloquent transactions"

Browse Popular Code Answers by Language