How to see the file uploaded using ->url()?

I already linked my storage, so it was on public/storage and I know laravel have a safety about accessing the url of public/storage. I would like to know how can I access the file via url as logged in user?
Solution:
TextColumn::make('document')
->url(fn (YourModel $record): ?string => Storage::url($record->document))
->openUrlInNewTab()
TextColumn::make('document')
->url(fn (YourModel $record): ?string => Storage::url($record->document))
->openUrlInNewTab()
...
Jump to solution
7 Replies
LeandroFerreira
LeandroFerreira4mo ago
You can also use the Storage facade, like this Storage::url('filename.jpg')
itsmejyv
itsmejyvOP4mo ago
not an image but a pdf file
LeandroFerreira
LeandroFerreira4mo ago
a link to download it?
itsmejyv
itsmejyvOP4mo ago
Here, this is the table of the resources. so what I would like to happen is when I try to click the file it will open new tab to view the entire pdf using the built-in browser reader
No description
Solution
LeandroFerreira
LeandroFerreira4mo ago
TextColumn::make('document')
->url(fn (YourModel $record): ?string => Storage::url($record->document))
->openUrlInNewTab()
TextColumn::make('document')
->url(fn (YourModel $record): ?string => Storage::url($record->document))
->openUrlInNewTab()
itsmejyv
itsmejyvOP4mo ago
Thanks man! @Leandro Ferreira Use of unknown class: 'App\Filament\Resources\Storage'PHP(PHP0413) what to import? ah I already figured out. use Illuminate\Support\Facades\Storage;
Want results from more Discord servers?
Add your server