orderByDesc('created_at'); if ($request->filled('project_id')) { $query->where('project_id', $request->input('project_id')); } if ($request->filled('job_name')) { $query->where('job_name', $request->input('job_name')); } if ($request->filled('status')) { $query->where('status', $request->input('status')); } $perPage = min((int) $request->input('per_page', 20), 100); $deployments = $query->paginate($perPage); return response()->json($deployments); } public function show(int $id): JsonResponse { $deployment = JenkinsDeployment::with('project:id,slug,name')->findOrFail($id); return response()->json($deployment); } }