diff --git a/app/Classes/Modules/Banks/ControllersLogic/UpdateBankMetadataLogic.php b/app/Classes/Modules/Banks/ControllersLogic/UpdateBankMetadataLogic.php index 1dc79f1a..e73d051a 100644 --- a/app/Classes/Modules/Banks/ControllersLogic/UpdateBankMetadataLogic.php +++ b/app/Classes/Modules/Banks/ControllersLogic/UpdateBankMetadataLogic.php @@ -59,7 +59,7 @@ class UpdateBankMetadataLogic extends AbstractControllerLogic $this->canUpdateBankMetadata->passes($bankMetadataObject); $transaction = $this->fetchesTransaction->execute(['id' => $request->input('transactionId')]); - $transaction->attributes()->delete(); + $transaction->attributesKVP()->delete(); return $this->response([]); } diff --git a/app/Classes/Modules/Banks/Processors/UpdateBankProcessor.php b/app/Classes/Modules/Banks/Processors/UpdateBankProcessor.php index a646cb95..6030c11d 100644 --- a/app/Classes/Modules/Banks/Processors/UpdateBankProcessor.php +++ b/app/Classes/Modules/Banks/Processors/UpdateBankProcessor.php @@ -66,7 +66,7 @@ class UpdateBankProcessor // if ($result->wasRecentlyCreated) { //Key #1 for Bank - $kvp = $bank->attributes()->where('key', 'App\Models\Bank')->where('value', $result->id)->latest()->first(); + $kvp = $bank->attributesKVP()->where('key', 'App\Models\Bank')->where('value', $result->id)->latest()->first(); if(!$kvp){ $keyValuePairObject = new KeyValuePairObject( "App\Models\Bank", diff --git a/app/Models/Bank.php b/app/Models/Bank.php index 30a429ae..42cdf3df 100644 --- a/app/Models/Bank.php +++ b/app/Models/Bank.php @@ -75,7 +75,7 @@ class Bank extends AbstractModel implements KeyValueInterface /** * @return MorphMany */ - public function attributes(): MorphMany + public function attributesKVP(): MorphMany { return $this->morphMany(KeyValuePair::class, 'owner'); } diff --git a/app/Models/Transaction.php b/app/Models/Transaction.php index dc18faa1..c84c0238 100644 --- a/app/Models/Transaction.php +++ b/app/Models/Transaction.php @@ -272,7 +272,7 @@ class Transaction extends AbstractModel implements Documentable, Transactionable /** * @return MorphMany */ - public function attributes(): MorphMany + public function attributesKVP(): MorphMany { return $this->morphMany(KeyValuePair::class, 'owner'); } @@ -283,7 +283,7 @@ class Transaction extends AbstractModel implements Documentable, Transactionable */ public function getBankAttribute() { - $keyValuePairs = $this->attributes()->where('key', 'App\Models\Bank')->latest()->first(); + $keyValuePairs = $this->attributesKVP()->where('key', 'App\Models\Bank')->latest()->first(); if($keyValuePairs){ $bank = Bank::where('id', $keyValuePairs->value)->first(); return $bank;