Fixed reports in deletion service

This commit is contained in:
Constantin Graf
2024-12-20 19:28:10 -05:00
parent dd312b396b
commit bad1cd1343
2 changed files with 14 additions and 1 deletions

View File

@@ -13,6 +13,7 @@ use App\Models\Organization;
use App\Models\OrganizationInvitation;
use App\Models\Project;
use App\Models\ProjectMember;
use App\Models\Report;
use App\Models\Tag;
use App\Models\Task;
use App\Models\TimeEntry;
@@ -71,6 +72,9 @@ class DeletionService
// Delete all clients
Client::query()->whereBelongsTo($organization, 'organization')->delete();
// Delete all reports
Report::query()->whereBelongsTo($organization, 'organization')->delete();
// Reset the current organization
$organization->owner()
->where('current_team_id', $organization->getKey())