How to make a URL column?

Is there anything like Forms\Components*Url*::make? where you can provide a display text and url, and it will render a link
Solution:
The url method accepts a callback so you can just access the record object to get any property from the model, something like this (obviously no idea what your column setup is)
Tables\Columns\TextColumn::make('url_display_text')
->url(fn ($record) => $record->url),
Tables\Columns\TextColumn::make('url_display_text')
->url(fn ($record) => $record->url),
...
Jump to solution
3 Replies
atabegruslan
atabegruslan3mo ago
Ok, But if I have the link text from one model field, and the link url from another model field, how can it all come together?
Solution
ConnorHowell
ConnorHowell3mo ago
The url method accepts a callback so you can just access the record object to get any property from the model, something like this (obviously no idea what your column setup is)
Tables\Columns\TextColumn::make('url_display_text')
->url(fn ($record) => $record->url),
Tables\Columns\TextColumn::make('url_display_text')
->url(fn ($record) => $record->url),
Want results from more Discord servers?
Add your server