F
Filament12mo ago
cakan

TextEntry url

I have a custom page and it displays Infolist with some TextEntries. In my custom page I have this code:
public function fileViewInfolist(Infolist $infolist): Infolist
{
return $infolist
->record($this->company)
->schema([
TextEntry::make('files.path')
->label('')
->badge()
->color('secondary')
->url('files.path')
->openUrlInNewTab()
]);
}
public function fileViewInfolist(Infolist $infolist): Infolist
{
return $infolist
->record($this->company)
->schema([
TextEntry::make('files.path')
->label('')
->badge()
->color('secondary')
->url('files.path')
->openUrlInNewTab()
]);
}
So there is a company model which can have multiple files. This will display a list of all files. But I want to be able to have file name displayed to be clickable and link to a file. Issue is that in database (files.path) is stored only a filename. In order to have full url, I must do asset('storage/'. $filenameFromDB). How can I do that?
1 Reply
cakan
cakanOP12mo ago
Also, I have tried using solutionforest/Filament-SimpleLightBox plugin, but I have the same issue with additional issue being that ->SimpleLightbox() accepts url only as a string 😢
Want results from more Discord servers?
Add your server