service->getByProvider($id); return $this->successResponse( payload: ProviderPaymentMethodResource::collection($paymentMethods) ); } public function show(int $id): ProviderPaymentMethodResource { $paymentMethod = $this->service->findById($id); abort_if(!$paymentMethod, 404); return new ProviderPaymentMethodResource($paymentMethod); } public function store(ProviderPaymentMethodRequest $request): JsonResponse { $paymentMethod = $this->service->create($request->validated()); return $this->successResponse( payload: new ProviderPaymentMethodResource($paymentMethod) ); } public function update(ProviderPaymentMethodRequest $request, int $id): JsonResponse { $paymentMethod = $this->service->findById($id); abort_if(!$paymentMethod, 404); $paymentMethod = $this->service->update($paymentMethod, $request->validated()); return $this->successResponse( payload: new ProviderPaymentMethodResource($paymentMethod) ); } public function destroy(int $id): JsonResponse { $paymentMethod = $this->service->findById($id); $this->service->delete($paymentMethod); return $this->successResponse( message: __("messages.deleted"), code: 204, ); } }