summarize Count icons take all icons as false

Hi All, i am making a list of data with a column that display icon which shown file exists or not.
Tables\Columns\IconColumn::make('pdf_filename')
->label('PDF File')
->true('heroicon-o-document-check','indigo')
->false('heroicon-o-x-circle','danger')
->boolean()->getStateUsing(function (TempInvoiceList $record) : bool {
return
$record->pdf_filename
&&
File::exists(storage_path('app/public/pdf/' . $this->getPeriod($record) . '/' . $record->pdf_filename))
? true : false;
})
->summarize(Count::make()->icons())
->url(fn (TempInvoiceList $record): ?string =>
$record->pdf_filename && $record->status_file === 'GENERATED'
? route('invoice', ['period' => $this->getPeriod($record) ,'name' => $record->pdf_filename])
: null,
shouldOpenInNewTab: true)
->alignCenter(),
Tables\Columns\IconColumn::make('pdf_filename')
->label('PDF File')
->true('heroicon-o-document-check','indigo')
->false('heroicon-o-x-circle','danger')
->boolean()->getStateUsing(function (TempInvoiceList $record) : bool {
return
$record->pdf_filename
&&
File::exists(storage_path('app/public/pdf/' . $this->getPeriod($record) . '/' . $record->pdf_filename))
? true : false;
})
->summarize(Count::make()->icons())
->url(fn (TempInvoiceList $record): ?string =>
$record->pdf_filename && $record->status_file === 'GENERATED'
? route('invoice', ['period' => $this->getPeriod($record) ,'name' => $record->pdf_filename])
: null,
shouldOpenInNewTab: true)
->alignCenter(),
The icon displayed correctly as intended. But, the summarize won't work. It counted all rows with the icon for false condition. Can someone help me? Thanks before.
1 Reply
Dennyvik
Dennyvik6mo ago
from the debug session i had, it seems like the summarize (or Count::) run the getStateuUsing again twice but didn't use the relationship or couldn't, resulted in false on every iteration