Set default export directory

How can I set the directory for my exports? I'm using s3 but everything is going to filament_exports/ I want to change this to something more custom.
Solution:
Ended up creating a custom Export model ``` <?php ...
Jump to solution
5 Replies
Will Aguilar
Will AguilarOP2w ago
Sorry my question was to broad. I do have setup the global config
ExportAction::configureUsing(function (ExportAction $action): void {
$action->fileDisk('s3');
});
ExportAction::configureUsing(function (ExportAction $action): void {
$action->fileDisk('s3');
});
But I want to be able to add a folder inside the bucket... something like this:
{bucket}/{client_id}/exports/
{bucket}/{client_id}/exports/
awcodes
awcodes2w ago
Ah, not an expert with s3, but would appending the filename with a directory create the directory in the bucket?
Solution
Will Aguilar
Will Aguilar2w ago
Ended up creating a custom Export model
<?php

namespace App\Models;

use App;
use Filament\Actions\Exports\Models\Export as BaseExport;

class Export extends BaseExport
{
public function getFileDirectory(): string
{
// build full path here
$fullPath = ....
return $fullPath;
}
}
<?php

namespace App\Models;

use App;
use Filament\Actions\Exports\Models\Export as BaseExport;

class Export extends BaseExport
{
public function getFileDirectory(): string
{
// build full path here
$fullPath = ....
return $fullPath;
}
}
and then binding it 😅
// Bind custom Export model for Filament exports
$this->app->bind(
\Filament\Actions\Exports\Models\Export::class,
\App\Models\Export::class
);
// Bind custom Export model for Filament exports
$this->app->bind(
\Filament\Actions\Exports\Models\Export::class,
\App\Models\Export::class
);
Probably appending the path to the file might be the way to go also, didn't try that way.
awcodes
awcodes2w ago
Looks good. I don’t see a way to do it on the current ExportAction natively, so without a PR to add it extending the class seems proper.

Did you find this page helpful?