service->getByClientId($clientId); return $this->successResponse( payload: ClientPaymentMethodResource::collection($paymentMethods) ); } public function show(int $id): JsonResponse { $paymentMethod = $this->service->findById($id); return $this->successResponse( payload: new ClientPaymentMethodResource($paymentMethod) ); } public function store(ClientPaymentMethodRequest $request): JsonResponse { $paymentMethod = $this->service->create($request->validated()); return $this->successResponse( payload: new ClientPaymentMethodResource($paymentMethod), message: __('messages.created'), code: 201, ); } public function update(ClientPaymentMethodRequest $request, int $id): JsonResponse { $paymentMethod = $this->service->findById($id); $paymentMethod = $this->service->update($paymentMethod, $request->validated()); return $this->successResponse( payload: new ClientPaymentMethodResource($paymentMethod), message: __('messages.updated'), ); } public function destroy(int $id): JsonResponse { $paymentMethod = $this->service->findById($id); $this->service->delete($paymentMethod); return $this->successResponse( message: __('messages.deleted'), code: 204, ); } }