env_uuid)->first(); if (! $env) { return response()->json([ 'message' => 'Environment variable not found.', ], 404); } $found_app = $env->resource()->whereRelation('environment.project.team', 'id', $teamId)->first(); if (! $found_app) { return response()->json([ 'message' => 'Environment variable not found.', ], 404); } $env->delete(); return response()->json([ 'message' => 'Environment variable deleted.', ]); } }