fix project deletion and refactor some code

This commit is contained in:
peaklabs-dev
2024-10-18 13:48:41 +02:00
parent 5d62a46a16
commit 5a38b21d95
5 changed files with 20 additions and 10 deletions

View File

@@ -423,7 +423,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);
}