From 309cb5f1f7ccb705c7fdcba2ed8219b4da99d5c9 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 20 Jan 2021 09:35:19 +1100 Subject: [PATCH] Fixes for contact imports --- app/Traits/GenerateMigrationResources.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Traits/GenerateMigrationResources.php b/app/Traits/GenerateMigrationResources.php index 02efdd341ddd..efc3fbe96f82 100644 --- a/app/Traits/GenerateMigrationResources.php +++ b/app/Traits/GenerateMigrationResources.php @@ -232,7 +232,7 @@ trait GenerateMigrationResources 'shipping_state' => $client->shipping_state, 'shipping_postal_code' => $client->shipping_postal_code, 'shipping_country_id' => $client->shipping_country_id, - 'contacts' => $this->getClientContacts($client->contacts()->withTrashed()), + 'contacts' => $this->getClientContacts($client), 'settings' => $this->getClientSettings($client), 'created_at' => $client->created_at ? Carbon::parse($client->created_at)->toDateString() : null, 'updated_at' => $client->updated_at ? Carbon::parse($client->updated_at)->toDateString() : null, @@ -255,8 +255,10 @@ trait GenerateMigrationResources return $settings; } - protected function getClientContacts($contacts) + protected function getClientContacts($client) { + $contacts = Contact::where('client_id', $client->id)->withTrashed()->get(); + $transformed = []; foreach ($contacts as $contact) {