Once it reaches DB::commit, it throws an error. However, if I comment out the Schema::table code, it works in PHP 8.3. In PHP 7.3, it still works as expected.
try {
DB::beginTransaction();
// performing some model::create() operations
if(!empty($table)){
Schema::table($table, function (Blueprint $table) use ($newProfileField) {
$column_type = isset($newProfileField->fieldType) ? $newProfileField- >fieldType->sql_column_type : 'string';
$table->$column_type($newProfileField->field_name)->nullable();
});
}
DB::commit();
}
catch(Exception $ex) {
DB::rollback();
}
This is happening once I upgraded my PHP version to 8.3
PDOException. There is no active transaction.