Answers for "database transactions in laravel"

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 "database transactions in laravel"

Browse Popular Code Answers by Language