Skip to content

Commit

Permalink
Add logfor empty user
Browse files Browse the repository at this point in the history
  • Loading branch information
austinkregel committed Dec 31, 2023
1 parent ec4ab55 commit 02bd9aa
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions app/Listeners/Finance/ApplyUserAutomatedTagsToTransaction.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

namespace App\Listeners\Finance;

Expand Down Expand Up @@ -37,6 +38,14 @@ public function handle(TransactionCreated $event): void
$account = $transaction->account;
$user = $account->credential->user;

if (empty($user)) {
$this->logger->warning('No user found for account', [
'account' => $account->id,
'transaction' => $transaction->id,
'credential' => $account->credential?->id
]);
return;
}

$tags = $user->tags()->with('conditions')->where('type', 'automatic')->get();

Expand Down

0 comments on commit 02bd9aa

Please sign in to comment.