diff --git a/app/Livewire/SharedVariables/Environment/Show.php b/app/Livewire/SharedVariables/Environment/Show.php
index 6c8342c41..6b1d35d14 100644
--- a/app/Livewire/SharedVariables/Environment/Show.php
+++ b/app/Livewire/SharedVariables/Environment/Show.php
@@ -5,6 +5,7 @@
use App\Models\Application;
use App\Models\Project;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
+use Illuminate\Support\Facades\DB;
use Livewire\Component;
class Show extends Component
@@ -98,23 +99,26 @@ public function submit()
private function handleBulkSubmit()
{
$variables = parseEnvFormatToArray($this->variables);
- $changesMade = false;
- // Delete removed variables
- $deletedCount = $this->deleteRemovedVariables($variables);
- if ($deletedCount > 0) {
- $changesMade = true;
- }
+ DB::transaction(function () use ($variables) {
+ $changesMade = false;
- // Update or create variables
- $updatedCount = $this->updateOrCreateVariables($variables);
- if ($updatedCount > 0) {
- $changesMade = true;
- }
+ // Delete removed variables
+ $deletedCount = $this->deleteRemovedVariables($variables);
+ if ($deletedCount > 0) {
+ $changesMade = true;
+ }
- if ($changesMade) {
- $this->dispatch('success', 'Environment variables updated.');
- }
+ // Update or create variables
+ $updatedCount = $this->updateOrCreateVariables($variables);
+ if ($updatedCount > 0) {
+ $changesMade = true;
+ }
+
+ if ($changesMade) {
+ $this->dispatch('success', 'Environment variables updated.');
+ }
+ });
}
private function deleteRemovedVariables($variables)
diff --git a/app/Livewire/SharedVariables/Project/Show.php b/app/Livewire/SharedVariables/Project/Show.php
index a3abe5df2..93ead33a3 100644
--- a/app/Livewire/SharedVariables/Project/Show.php
+++ b/app/Livewire/SharedVariables/Project/Show.php
@@ -4,6 +4,7 @@
use App\Models\Project;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
+use Illuminate\Support\Facades\DB;
use Livewire\Component;
class Show extends Component
@@ -95,23 +96,26 @@ public function submit()
private function handleBulkSubmit()
{
$variables = parseEnvFormatToArray($this->variables);
- $changesMade = false;
- // Delete removed variables
- $deletedCount = $this->deleteRemovedVariables($variables);
- if ($deletedCount > 0) {
- $changesMade = true;
- }
+ DB::transaction(function () use ($variables) {
+ $changesMade = false;
- // Update or create variables
- $updatedCount = $this->updateOrCreateVariables($variables);
- if ($updatedCount > 0) {
- $changesMade = true;
- }
+ // Delete removed variables
+ $deletedCount = $this->deleteRemovedVariables($variables);
+ if ($deletedCount > 0) {
+ $changesMade = true;
+ }
- if ($changesMade) {
- $this->dispatch('success', 'Environment variables updated.');
- }
+ // Update or create variables
+ $updatedCount = $this->updateOrCreateVariables($variables);
+ if ($updatedCount > 0) {
+ $changesMade = true;
+ }
+
+ if ($changesMade) {
+ $this->dispatch('success', 'Environment variables updated.');
+ }
+ });
}
private function deleteRemovedVariables($variables)
diff --git a/app/Livewire/SharedVariables/Team/Index.php b/app/Livewire/SharedVariables/Team/Index.php
index 6311d9a87..bd23bca82 100644
--- a/app/Livewire/SharedVariables/Team/Index.php
+++ b/app/Livewire/SharedVariables/Team/Index.php
@@ -4,6 +4,7 @@
use App\Models\Team;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
+use Illuminate\Support\Facades\DB;
use Livewire\Component;
class Index extends Component
@@ -89,23 +90,26 @@ public function submit()
private function handleBulkSubmit()
{
$variables = parseEnvFormatToArray($this->variables);
- $changesMade = false;
- // Delete removed variables
- $deletedCount = $this->deleteRemovedVariables($variables);
- if ($deletedCount > 0) {
- $changesMade = true;
- }
+ DB::transaction(function () use ($variables) {
+ $changesMade = false;
- // Update or create variables
- $updatedCount = $this->updateOrCreateVariables($variables);
- if ($updatedCount > 0) {
- $changesMade = true;
- }
+ // Delete removed variables
+ $deletedCount = $this->deleteRemovedVariables($variables);
+ if ($deletedCount > 0) {
+ $changesMade = true;
+ }
- if ($changesMade) {
- $this->dispatch('success', 'Environment variables updated.');
- }
+ // Update or create variables
+ $updatedCount = $this->updateOrCreateVariables($variables);
+ if ($updatedCount > 0) {
+ $changesMade = true;
+ }
+
+ if ($changesMade) {
+ $this->dispatch('success', 'Environment variables updated.');
+ }
+ });
}
private function deleteRemovedVariables($variables)
diff --git a/resources/views/livewire/shared-variables/environment/show.blade.php b/resources/views/livewire/shared-variables/environment/show.blade.php
index 02cc07b28..fde2d0ae8 100644
--- a/resources/views/livewire/shared-variables/environment/show.blade.php
+++ b/resources/views/livewire/shared-variables/environment/show.blade.php
@@ -9,9 +9,7 @@