Use note object instead of field #888

This commit is contained in:
James Cole
2017-10-03 10:30:56 +02:00
parent 4af0c18020
commit d1a6b37eb3
7 changed files with 59 additions and 11 deletions

View File

@@ -48,7 +48,8 @@ class Note extends Model
}
/**
* Get all of the owning noteable models. Currently only piggy bank
* Get all of the owning noteable models. Currently piggy bank and
* transaction journal
*/
public function noteable()
{

View File

@@ -260,6 +260,14 @@ class TransactionJournal extends Model
return $this->transactionType->isWithdrawal();
}
/**
* Get all of the notes.
*/
public function notes()
{
return $this->morphMany('FireflyIII\Models\Note', 'noteable');
}
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/