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
You can also use the Storage facade, like this Storage::url('filename.jpg')
itsmejyv
itsmejyv4w ago
not an image but a pdf file
LeandroFerreira
a link to download it?
itsmejyv
itsmejyv4w 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
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
itsmejyv4w 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