F
Filament15mo ago
Jaw

How can i display the same column twice?

ImageColumn::make('url')
->width(100)
->height(100)
->label('Image'),
TextColumn::make('url')
->formatStateUsing(function ($state) {
$currentUrl = request()->getSchemeAndHttpHost();
$downloadLink = "$currentUrl/storage/$state";

return "<a href='$downloadLink' class='danger' download>Download</a>";
})
->html()
->label('Attachment'),
ImageColumn::make('url')
->width(100)
->height(100)
->label('Image'),
TextColumn::make('url')
->formatStateUsing(function ($state) {
$currentUrl = request()->getSchemeAndHttpHost();
$downloadLink = "$currentUrl/storage/$state";

return "<a href='$downloadLink' class='danger' download>Download</a>";
})
->html()
->label('Attachment'),
2 Replies
awcodes
awcodes15mo ago
Basically, you can’t. Column names need to be unique. This is also important for accessibility compliance too. But you can name it something different and in your methods instead of $state you also have access to $record so you can call $record->url in any of those callbacks to do what you need to for the column.
blakdronzer
blakdronzer15mo ago
Well i guess there is 1 way - you can create an attribute in the model and call it istead !
Want results from more Discord servers?
Add your server