Fixes for polymorphics company types

This commit is contained in:
David Bomba 2024-11-27 16:52:35 +11:00
parent 40efdc81c7
commit 140328bb53
1 changed files with 2 additions and 1 deletions

View File

@ -11,6 +11,7 @@
namespace App\Jobs\Invoice;
use App\Models\Company;
use App\Models\Invoice;
use CleverIt\UBL\Invoice\Address;
use CleverIt\UBL\Invoice\Contact;
@ -125,7 +126,7 @@ class CreateUbl implements ShouldQueue
if ($company->country_id) {
$country = new Country();
$country->setIdentificationCode($company->country()->iso_3166_2);
$country->setIdentificationCode(($company instanceof Company) ? $company->country()->iso_3166_2 : $company->country->iso_3166_2);
$address->setCountry($country);
}