Skip to content

Commit 317c410

Browse files
author
Marc Geurts
committed
Removed double logging team deletion in Team model
1 parent 0d54389 commit 317c410

File tree

1 file changed

+16
-36
lines changed

1 file changed

+16
-36
lines changed

app/Models/Team.php

Lines changed: 16 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -173,42 +173,22 @@ protected function performDeveloperDelete(): void
173173
// Load relationships once to avoid N+1 queries
174174
$this->load(['couples', 'users']);
175175

176-
// Disable activity logging globally during cleanup
177-
config(['activitylog.enabled' => false]);
178-
179-
try {
180-
// Delete all persons and their photos and files
181-
$this->persons->each(function ($person): void {
182-
// remove photos
183-
// remove files
184-
185-
$person->forceDelete();
186-
});
187-
188-
// Delete all couples
189-
$this->couples->each(function ($couple): void {
190-
$couple->delete();
191-
});
192-
193-
// Disconnect all users from this team
194-
$this->users()->detach();
195-
} finally {
196-
// Re-enable activity logging
197-
config(['activitylog.enabled' => true]);
198-
}
199-
200-
// Log a single comprehensive activity after cleanup
201-
activity()
202-
->causedBy(auth()->user())
203-
->performedOn($this)
204-
->withProperties([
205-
'deleted_persons_count' => $this->persons->count(),
206-
'deleted_couples_count' => $this->couples->count(),
207-
'detached_users_count' => $this->users->count(),
208-
'team_name' => $this->name,
209-
'reason' => 'Developer force delete with cleanup',
210-
])
211-
->log('Team deleted with full cleanup by developer');
176+
// Delete all persons and their photos and files
177+
$this->persons->each(function ($person): void {
178+
// TODO
179+
// remove photos
180+
// remove files
181+
182+
$person->forceDelete();
183+
});
184+
185+
// Delete all couples
186+
$this->couples->each(function ($couple): void {
187+
$couple->delete();
188+
});
189+
190+
// Disconnect all users from this team
191+
$this->users()->detach();
212192
});
213193
}
214194
}

0 commit comments

Comments
 (0)