Can I add a link into a Column? #239
-
|
Anyone know how to add a link with custom label? I'm trying to add a link to each row so that a table exported allows the user to quickly go back to any of the records. The link works when generating the Excel from HTML using \Maatwebsite\Excel\Facades\Excel However using the Bulk Action > ExcelExport it's not working Column::make('Link')
->heading('Link')
->width(10)
// ->format('html') this didn't change the output
->formatStateUsing(fn(Order $record) => '<a href="https://example.com/app/orders/'.$record->id.'">Link</a>'),
// Larger issue is that nothing with format State is working for me
// ->formatStateUsing(fn(Order $record) => $record->id) // <-- also not working |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
|
I have managed to get it working with this code Column::make('id')
->heading('Links')
->width(30)
->formatStateUsing(fn($state) => '=HYPERLINK("'.OrderResource::getUrl('view', [$state]).'", "Link")'),However, I don't see why the original code I tried is not working. |
Beta Was this translation helpful? Give feedback.
-
|
I wonder if this |
Beta Was this translation helpful? Give feedback.
I have managed to get it working with this code
However, I don't see why the original code I tried is not working.