Customizing Filament Export Action
Hello everyone, I would need some help with an issue I'm facing regarding the export action in Filament. Currently, I have a resource where I allow exporting using Filament's standard export action. After several attempts, I managed to get database notifications working as well, all very nice. Unfortunately, I can't figure out how to override/modify the link for downloading the file.
I have a customized setup for the application's storage (it's not located internally but at a specific path on the Linux machine hosting my app). Using route:list, I noticed that there's a Filament route 'filament/exports/{id}/download' that is definitely used for returning the file to download, but I can't seem to access it or override it.
Could you help me in some way? I could solve it in different ways; I just need to override the link with my custom one pointing to a route I created (already existing and working for other downloads). Thank you very much!
34 Replies
As you can see the notification is working perfectly fine!
You should use the storage disk:
https://filamentphp.com/docs/3.x/actions/prebuilt-actions/export#customizing-the-storage-disk
Once the disk is set, then you should be able to set the url method on the disk too.
Thanks for the fast reply. This is my code (i added now the disk method, but actually it is the default one).
I can't understand how and where should i override the url u mentioned? ty
you set fileDisk = download. So download is the disk defined in filesystem.php
Yes of course 🙂 is this the url method i have to modify?
I believe so
mmm it doesn't change the notification link..
are you getting a 419 by any chance?
If you mean an error code 419, nope.
So what are you trying to change?
This download link:
But why? The download link is a route for filament to fetch the file and download it. It's not a direct link.
I just want it working fine... and it isn't
So the file isn't downloading?
nop!
What is the error?
inspect the network
what's the error. I have a feeling it is 419
500, so inspect your logs to what is causing a 500
Also, under my storage folder filament is saving the file under /filament_exports/{DINAMIC ID}/file.xlsx
That's correct
This route is trying to download from, filament/exports, no way its gona work(?)
Read the route. It's a download function of a file. not a direct link.
which runs
mmmm thanks due 😄
I fixed it!
What was it..
Solution
actually linux permissions on the folder...
Well done
to you! Thank you very much
how you change the permission ? I want to have when new folder created it should be use www-data
You don't you should setup your server correctly since that's handled by php-fpm.
Yeah . Apparently I set my supervisor wrong .