Is it possible to modify the aggregation column query?

I am currently loading the sum of amount field from transactions relation on my CoinsPack model using the following code. The Transaction has a
status
field which can be either pending, cancelled and successful and I want the sum of amount column for only successful transactions.

Tables\Columns\TextColumn::make('transactions_sum_amount')
    ->sum('transactions', 'amount')
    ->money('USD')
    ->label('Sales')
    ->placeholder('No sales'),
Was this page helpful?