This should complete the account handler.

This commit is contained in:
James Cole
2015-02-14 14:25:29 +01:00
parent 7785ec0222
commit 1d78f98ec8
15 changed files with 494 additions and 9 deletions

View File

@@ -188,4 +188,17 @@ class TransactionJournal extends Model
return $this->belongsTo('FireflyIII\User');
}
/**
* @param EloquentBuilder $query
* @param Account $account
*/
public function scopeAccountIs(EloquentBuilder $query, Account $account)
{
if (!isset($this->joinedTransactions)) {
$query->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id');
$this->joinedTransactions = true;
}
$query->where('transactions.account_id', $account->id);
}
}