Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Configuration file needed + possibility to set filesystem (S3) disk from config #152

Open
ValtersBergs opened this issue Dec 8, 2023 · 5 comments

Comments

@ValtersBergs
Copy link

Hello! For now, the plugin has a disk that is hard-coded locally (filesystems.disks.filament-excel). It would be great if the plugin had a configuration file where you can specify which predefined in filesystems file system to work with. For example - S3.

Currently, the plugin does not work if the laravel site runs on multiple servers, or if another queue server is already in use.

@pxlrbt
Copy link
Owner

pxlrbt commented Dec 11, 2023

Can't you just override the defined disk to make it work?

@ValtersBergs
Copy link
Author

ValtersBergs commented Dec 11, 2023

To make override, i need to extend FilamentExcelServiceProvider and override register method (to rewite config), then disable discovery (dont-discover) of pxlrbt/filament-excel in composer json.
Than i need to rewrite routes for s3.
Yes, i can do this, but then i am stuck with specific plugin version, because i rewrote part of functionality.

routes changes:
`Route::get('filament-excel/{path}', function (string $path) {
app()->terminating(function () use ($path) {
Storage::disk('filament-excel')->delete($path);
});

return Storage::disk('filament-excel')->response($path, substr($path, 37));

})
->where('path', '.*')
->name('filament-excel-download');`

Config with disk setting would be great with manual how to set it, i guess.

@ValtersBergs
Copy link
Author

For other users: for dedicated queues you need to publish Maatwebsite excel config and in generated file excel.php set 'remote_disk' => 's3',

  1. php artisan vendor:publish --provider="Maatwebsite\Excel\ExcelServiceProvider" --tag=config
  2. excel.php 'remote_disk' => 's3',

@pxlrbt
Copy link
Owner

pxlrbt commented Dec 11, 2023

I assume you can just override the configuration in your AppServiceProviders boot() method:

config()->set('filesystems.disks.filament-excel', [
    'driver' => 'your_driver',
    // other configuration option
]);

@lloricode
Copy link
Contributor

I assume you can just override the configuration in your AppServiceProviders boot() method:

config()->set('filesystems.disks.filament-excel', [
    'driver' => 'your_driver',
    // other configuration option
]);

much better setup this via config, then can be visible to the filesystems configuration,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants