fix: Handle project not found error in environment_details API endpoint

This commit is contained in:
Andras Bacsai
2024-09-05 11:18:00 +02:00
parent 22bd305e8f
commit 08b9c79298

View File

@@ -145,6 +145,9 @@ class ProjectController extends Controller
return response()->json(['message' => 'Environment name is required.'], 422);
}
$project = Project::whereTeamId($teamId)->whereUuid($request->uuid)->first();
if (! $project) {
return response()->json(['message' => 'Project not found.'], 404);
}
$environment = $project->environments()->whereName($request->environment_name)->first();
if (! $environment) {
return response()->json(['message' => 'Environment not found.'], 404);