This saves some queries.

This commit is contained in:
James Cole 2015-12-25 09:34:23 +01:00
parent 5b3beded39
commit 5862803434

View File

@ -68,6 +68,7 @@ use Watson\Validating\ValidatingTrait;
* @property-read int $account_id * @property-read int $account_id
* @property string $name * @property string $name
* @property-read string $symbol * @property-read string $symbol
* @property-read string $type
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Attachment[] $attachments * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Attachment[] $attachments
* @property-read mixed $amount_positive * @property-read mixed $amount_positive
*/ */
@ -503,6 +504,10 @@ class TransactionJournal extends Model
*/ */
public function isWithdrawal() public function isWithdrawal()
{ {
if (!is_null($this->type)) {
return $this->type == TransactionType::WITHDRAWAL;
}
return $this->transactionType->isWithdrawal(); return $this->transactionType->isWithdrawal();
} }
@ -511,6 +516,10 @@ class TransactionJournal extends Model
*/ */
public function isDeposit() public function isDeposit()
{ {
if (!is_null($this->type)) {
return $this->type == TransactionType::DEPOSIT;
}
return $this->transactionType->isDeposit(); return $this->transactionType->isDeposit();
} }
@ -519,6 +528,10 @@ class TransactionJournal extends Model
*/ */
public function isTransfer() public function isTransfer()
{ {
if (!is_null($this->type)) {
return $this->type == TransactionType::TRANSFER;
}
return $this->transactionType->isTransfer(); return $this->transactionType->isTransfer();
} }
@ -527,6 +540,10 @@ class TransactionJournal extends Model
*/ */
public function isOpeningBalance() public function isOpeningBalance()
{ {
if (!is_null($this->type)) {
return $this->type == TransactionType::OPENING_BALANCE;
}
return $this->transactionType->isOpeningBalance(); return $this->transactionType->isOpeningBalance();
} }
} }