If you get the destination account attribute before the model is saved, the cache breaks.

This commit is contained in:
James Cole 2016-01-13 14:01:40 +01:00
parent ae3258b449
commit 88bbafd3e8

View File

@ -290,16 +290,8 @@ class TransactionJournal extends Model
*/
public function getDestinationAccountAttribute()
{
$cache = new CacheProperties;
$cache->addProperty($this->id);
$cache->addProperty('destinationAccount');
if ($cache->has()) {
return $cache->get(); // @codeCoverageIgnore
}
$account = $this->transactions()->where('amount', '>', 0)->first()->account;
$cache->store($account);
return $account;
}