Do not update when no event connected.

This commit is contained in:
James Cole
2015-03-03 08:46:14 +01:00
parent f0316f09ed
commit fa344d5308
2 changed files with 9 additions and 0 deletions

View File

@@ -32,6 +32,9 @@ class UpdateJournalConnection
// get the event connected to this journal:
/** @var PiggyBankEvent $event */
$event = PiggyBankEvent::where('transaction_journal_id', $journal->id)->first();
if(is_null($event)) {
return;
}
$piggyBank = $event->piggyBank()->first();
$repetition = $piggyBank->piggyBankRepetitions()->relevantOnDate($journal->date)->first();