summarize and custom model attribute
Hi
I have a model attribute:
And I would like to summarize the sum_retail column.
With this notation, summarize does not work, but row summation works:
With this notation, summarize works, but row summation does not work.
So how should this be correct?
I have a model attribute:
protected function sumRetail(): Attribute
{
return Attribute::make(
get: fn () => $this->price_retail * $this->qty
);
}And I would like to summarize the sum_retail column.
With this notation, summarize does not work, but row summation works:
TablesColumnsTextColumn::make('sum_retail')->label('Value.')->alignRight()
->summarize(Sum::make()->numeric(decimalPlaces: 2)),With this notation, summarize works, but row summation does not work.
TablesColumnsTextColumn::make('price_retail * qty')->label('Value')->alignRight()
->summarize(Sum::make()->numeric(decimalPlaces: 2)),So how should this be correct?