F
Filament10mo ago
Jessy

How to Upgrade to v3.2?

composer update php artisan filament:upgrade At php artisan about, I have: Filament Version ............... v3.1.47
19 Replies
Dennis Koch
Dennis Koch10mo ago
Probably a conflict or a constraint on the version. Try composer require filament/filament:^3.2 and see what error it outputs
Jessy
JessyOP10mo ago
filament/filament v3.2.0 requires filament/actions v3.2.0 -> found filament/actions[v3.2.0] but the package is fixed to v3.1.47 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
Dennis Koch
Dennis Koch10mo ago
Ah sorry, try composer require -W filament/filament:^3.2
Jessy
JessyOP10mo ago
ok, now the version is v3.2.24. but I can't use Filament\Tables\Actions\ExportAction;, it says Class...not found
Dennis Koch
Dennis Koch10mo ago
Please share the exact error #✅┊rules
Jessy
JessyOP10mo ago
Class "App\Filament\Exports\ProductExporter" not found
Dennis Koch
Dennis Koch10mo ago
That's a different error than you just shared Did you create the actual file that you are trying to import?
Jessy
JessyOP10mo ago
I'm using in a custom page a filament table and use
use App\Filament\Exports\ProductExporter;
use Filament\Tables\Actions\ExportAction;
use Filament\Tables\Actions\ExportBulkAction;

....

->headerActions([
ExportAction::make()
->exporter(ProductExporter::class)
])
->bulkActions([
ExportBulkAction::make()
->exporter(ProductExporter::class)
]);
use App\Filament\Exports\ProductExporter;
use Filament\Tables\Actions\ExportAction;
use Filament\Tables\Actions\ExportBulkAction;

....

->headerActions([
ExportAction::make()
->exporter(ProductExporter::class)
])
->bulkActions([
ExportBulkAction::make()
->exporter(ProductExporter::class)
]);
Dennis Koch
Dennis Koch10mo ago
That doesn't answer my question. Did you create App\Filament\Exports\ProductExporter?
Jessy
JessyOP10mo ago
no
Dennis Koch
Dennis Koch10mo ago
There's your answer 😅
Jessy
JessyOP10mo ago
yeah😅 , thanks, is there an option to download the file when export? or is just saving the file in storage?
Dennis Koch
Dennis Koch10mo ago
I don't know. I haven't used the Export Action yet, but I guess a download should be the default?!
Jessy
JessyOP10mo ago
This is the message I got after export and the files are in storage.
No description
SirAlyon
SirAlyon10mo ago
Jessy it doesn't download the file.. I upgraded filament for the same thing. If you are interest i did a simple table that point to the exports table (i still trying to figure out how a plugin like that can be useful btw) I did something like:
class KiidReportDownload extends BaseWidget
{
public function table(Table $table): Table
{
return $table

->poll('4s')
->query(
Exports::query()->orderBy('id', 'desc')
)
->columns([
TextColumn::make('id'),
TextColumn::make('file_name')
->label('Nome File')
->badge(),
TextColumn::make('total_rows')
->label('Righe Totali'),
TextColumn::make('successful_rows')
->label('Righe Gestute'),
])
->actions([
Action::make('Downlaod')
->label('')
->icon('heroicon-s-inbox-arrow-down')
->size('lg')
->tooltip(fn (Exports $export): string => "Scarica {$export->file_name}")

->action(function (Exports $export) {

$fullPath = "filament_exports/$export->id/$export->file_name.xlsx";

if (Storage::disk('download')->exists($fullPath)) {
return Storage::download($fullPath, $export->file_name . 'xlsx');
} else {
Notification::make()
->title('Oops! Qualcosa è andato storto..')
->danger()
->send();
}
}),
]);
}
}
class KiidReportDownload extends BaseWidget
{
public function table(Table $table): Table
{
return $table

->poll('4s')
->query(
Exports::query()->orderBy('id', 'desc')
)
->columns([
TextColumn::make('id'),
TextColumn::make('file_name')
->label('Nome File')
->badge(),
TextColumn::make('total_rows')
->label('Righe Totali'),
TextColumn::make('successful_rows')
->label('Righe Gestute'),
])
->actions([
Action::make('Downlaod')
->label('')
->icon('heroicon-s-inbox-arrow-down')
->size('lg')
->tooltip(fn (Exports $export): string => "Scarica {$export->file_name}")

->action(function (Exports $export) {

$fullPath = "filament_exports/$export->id/$export->file_name.xlsx";

if (Storage::disk('download')->exists($fullPath)) {
return Storage::download($fullPath, $export->file_name . 'xlsx');
} else {
Notification::make()
->title('Oops! Qualcosa è andato storto..')
->danger()
->send();
}
}),
]);
}
}
Jessy
JessyOP10mo ago
Ty! I will try this. This is just a livewire component with extends BaseWidget?
SirAlyon
SirAlyon10mo ago
It's not. It is a table widget that I render inside a modal on the resource, but you can actually just utilize the same logic as you wish. As you can see it is attached with an Exports Model that will automatically query the exports table! Have fun 😊
Jessy
JessyOP10mo ago
I've made it, with Storage::download I got an error but I use the url with redirect. And I also got an error on ExportAction(), a column is not found, but the same raws are exported with ExportBulkAction. I don't understand why ExportBulkAction works and ExportAction don't, in my case.
SirAlyon
SirAlyon10mo ago
You must "return" the download method or it won't work. For the other issue maybe put the code I'll try to help tomorrow
Want results from more Discord servers?
Add your server