['sometimes', 'integer', 'exists:payments,id'], 'provider_id' => ['sometimes', 'integer', 'exists:providers,id'], 'gateway_provider' => ['sometimes', 'string', 'max:255'], 'gateway_entity_reference' => ['nullable', 'string', 'max:255'], 'gateway_entity_label' => ['nullable', 'string', 'max:255'], 'gateway_operation_reference' => ['nullable', 'string', 'max:255'], 'gateway_operation_label' => ['nullable', 'string', 'max:255'], 'gateway_parent_reference' => ['nullable', 'string', 'max:255'], 'gateway_parent_label' => ['nullable', 'string', 'max:255'], 'gateway_transfer_target_reference' => ['nullable', 'string', 'max:255'], 'gateway_transfer_target_label' => ['nullable', 'string', 'max:255'], 'status' => ['sometimes', 'in:pending,processing,transferred,failed,cancelled'], 'gross_amount' => ['sometimes', 'numeric', 'min:0'], 'gateway_fee_amount' => ['sometimes', 'numeric', 'min:0'], 'net_amount' => ['sometimes', 'numeric', 'min:0'], 'transferred_at' => ['nullable', 'date'], 'failed_at' => ['nullable', 'date'], 'failure_code' => ['nullable', 'string', 'max:255'], 'failure_message' => ['nullable', 'string'], 'gateway_payload' => ['nullable', 'array'], 'metadata' => ['nullable', 'array'], ]; if ($this->isMethod('POST')) { $rules['payment_id'] = ['required', 'integer', 'exists:payments,id']; $rules['provider_id'] = ['required', 'integer', 'exists:providers,id']; $rules['gross_amount'] = ['required', 'numeric', 'min:0']; $rules['net_amount'] = ['required', 'numeric', 'min:0']; } return $rules; } }