filament.exports.download giving 404 in multi-database multi-tenancy setup
I am using stancl/tenancy for multi database tenancy with filament. I've not enabled tenant features of filament itself, and instead relying on domain based tenancy provided by stancl/tenancy. I'm using the following configuration for tenancy:
In addition I'm using a custom
FileUrlMiddleware
with the following in handle
method:
This middleware is being used in routes/tenant.php
, config/livewire.php
, as well as in the TenantAdminPanelProvider
Also, during tenancy creation I'm setting the tenant public paths using a job, as below:
Base on this, all uploads for import are working fine, and data is getting imported alright. Similarly, when I'm trying to export the data, the files are getting created alright, such as: storage/tenant/0f7a82c3-f357-44f2-86c8-8e49e5bdc18f/app/public/filament_exports/1/0000000000000001.csv
which is linked from public/tenant/0f7a82c3-f357-44f2-86c8-8e49e5bdc18f/filament_exports/1/0000000000000001.csv
thanks to the above code.
However, the path http://tenant.app.test/filament/exports/1/download?format=csv
is giving 404.Solution:Jump to solution
Finally managed to solve this by copying the following lines in my
routes/tenant.php
:
```php
Route::get('/filament/exports/{export}/download', DownloadExport::class)
->name('filament.exports.download')
->middleware('filament.actions');...1 Reply
Solution
Finally managed to solve this by copying the following lines in my
routes/tenant.php
: