public function actualBalance()
    {
        $credits = $this->wallet->transactions()
            ->whereIn('type', ['deposit', 'refund'])
            ->where('accepted', 1)
            ->sum('amount');

        $debits = $this->wallet->transactions()
            ->whereIn('type', ['withdraw', 'payout'])
            ->where('accepted', 1)
            ->sum('amount');

        return $credits - $debits;
    }
public function actualBalance()
    {
        $credits = $this->wallet->transactions()
            ->whereIn('type', ['deposit', 'refund'])
            ->where('accepted', 1)
            ->sum('amount');

        $debits = $this->wallet->transactions()
            ->whereIn('type', ['withdraw', 'payout'])
            ->where('accepted', 1)
            ->sum('amount');

        return $credits - $debits;
    }
public function actualBalance ( ) { $ credits = $ this -> wallet -> transactions ( ) -> whereIn ( 'type' , [ 'deposit' , 'refund' ] ) -> where ( 'accepted' , 1 ) -> sum ( 'amount' ) ; $ debits = $ this -> wallet -> transactions ( ) -> whereIn ( 'type' , [ 'withdraw' , 'payout' ] ) -> where ( 'accepted' , 1 ) -> sum ( 'amount' ) ; return $ credits - $ debits ; }
Returns the actual balance for this wallet.
Might be different from the balance property if the database is manipulated
@return float balance
Returns the actual balance for this wallet . Might be different from the balance property if the database is manipulated