filament-excel icon indicating copy to clipboard operation
filament-excel copied to clipboard

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

Open ValtersBergs opened this issue 1 year ago • 5 comments

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.

ValtersBergs avatar Dec 08 '23 13:12 ValtersBergs

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

pxlrbt avatar Dec 11 '23 12:12 pxlrbt

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 avatar Dec 11 '23 13:12 ValtersBergs

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',

ValtersBergs avatar Dec 11 '23 13:12 ValtersBergs

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
]);

pxlrbt avatar Dec 11 '23 14:12 pxlrbt

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,

lloricode avatar Dec 13 '23 06:12 lloricode