Merge pull request #3949 from peaklabs-dev/fix-project-deletion

Fix: Projects can be deleted with resources
This commit is contained in:
Andras Bacsai
2024-11-07 13:43:56 +01:00
committed by GitHub
6 changed files with 21 additions and 11 deletions

View File

@@ -422,7 +422,7 @@ class ProjectController extends Controller
if (! $project) {
return response()->json(['message' => 'Project not found.'], 404);
}
if ($project->resource_count() > 0) {
if (! $project->isEmpty()) {
return response()->json(['message' => 'Project has resources, so it cannot be deleted.'], 400);
}