diff --git a/app/Models/PaymentMethod.php b/app/Models/PaymentMethod.php index 1a0f865be141..5b9a64757c0c 100644 --- a/app/Models/PaymentMethod.php +++ b/app/Models/PaymentMethod.php @@ -113,9 +113,9 @@ class PaymentMethod extends EntityModel */ public function scopeClientId($query, $clientId) { - return $query->with(['contact' => function($query) use ($clientId) { - return $query->whereClientId($clientId); - }]); + $query->whereHas('contact', function($query) use ($clientId) { + $query->whereClientId($clientId); + }); } /** diff --git a/app/Ninja/PaymentDrivers/BasePaymentDriver.php b/app/Ninja/PaymentDrivers/BasePaymentDriver.php index baef52a7a34e..9cc7c405431f 100644 --- a/app/Ninja/PaymentDrivers/BasePaymentDriver.php +++ b/app/Ninja/PaymentDrivers/BasePaymentDriver.php @@ -531,6 +531,7 @@ class BasePaymentDriver public function createPaymentMethod($customer) { $paymentMethod = PaymentMethod::createNew($this->invitation); + $paymentMethod->contact_id = $this->contact()->id; $paymentMethod->ip = Request::ip(); $paymentMethod->account_gateway_token_id = $customer->id; $paymentMethod->setRelation('account_gateway_token', $customer);