skip to Main Content

There is no active transaction Error in creating table using Db Facade laravel

$dbConnection = DB::connection('test_connection'); $dbConnection->beginTransaction(); try{ $dbConnection->getSchemaBuilder()->create('Alpha_1', function ($table) use ($validatedData) { $table->string('name')->nullable(); }); $dbConnection->commit(); } catch (Exception $e) { // Rollback the transaction in case of error $dbConnection->rollBack(); // Get the exact database error $errorMessage = $e->getMessage(); dd($errorMessage); } I…

VIEW QUESTION
Back To Top
Search