Eloquent:基于访问者属性的查询

I have an Account model which hasMany transactions. A transaction belongsTo a TransactionType (could be either "payment" or "charge"). Now I want to query all accounts with a negative balance, i.e. where the sum of the Transactions of type "payment" <= sum of Transactions of type charge. What is the most efficient way to do this with Laravel Eloquent? Is this scalable? I tried to query on the accessor attribute, but this did not work.

I created an accessor as follows:

public function getBalanceAttribute()
{
    return $this->payments->sum('amount') - $this->charges->sum('amount');
}

In my Account model I have:

/**
* Get all of the accounts's payments.
*/
public function payments()
{
    return $this->hasMany('App\Transaction')->whereTransactionTypeId(1);
}

/**
* Get all of the account's charges.
*/
public function charges()
{
    return $this->hasMany('App\Transaction')->whereTransactionTypeId(2);
}