From 7d7f05b5ee34b9157ceb456a61184f7a4b94d729 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 11 Jul 2022 09:11:59 +1000 Subject: [PATCH] Minor fixes for hosted --- app/Traits/GenerateMigrationResources.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/Traits/GenerateMigrationResources.php b/app/Traits/GenerateMigrationResources.php index e17c34a1c95e..0dc64825db24 100644 --- a/app/Traits/GenerateMigrationResources.php +++ b/app/Traits/GenerateMigrationResources.php @@ -443,12 +443,17 @@ trait GenerateMigrationResources if(!Utils::isNinja()) return $transformed; - $ninja_client = Client::where('public_id', $this->account->id)->first(); + $db = DB_NINJA_1; + + if($this->account->id > 1000000) + $db = DB_NINJA_2; + + $ninja_client = Client::on($db)->where('public_id', $this->account->id)->first(); if(!$ninja_client) return $transformed; - $agts = AccountGatewayToken::where('client_id', $ninja_client->id)->get(); + $agts = AccountGatewayToken::on($db)->where('client_id', $ninja_client->id)->get(); $is_default = true; if(count($agts) == 0) { @@ -464,7 +469,7 @@ trait GenerateMigrationResources if(!$payment_method) continue; - $contact = Contact::where('id', $payment_method->contact_id)->withTrashed()->first(); + $contact = Contact::on($db)->where('id', $payment_method->contact_id)->withTrashed()->first(); $transformed[] = [ 'id' => $payment_method->id,