Zen
Automatic Filament ViewAction on Livewire component
In th view page you can rewrite the mount() function and get $usserId = request()?->id; and get the record from the id or other wise you can just send to its argument using /users/2 instead.
6 replies
Multiple Unexpected Fetch Requests Triggered When Closing Modal After Create Action
I think it is a normal behaviour using a Resource Page, where the livewire update will be called every click. This does not happen if creating new Livewire component for this page separately.
5 replies
Export data
The request here. Basically, it use Queue and will notify in the Notification. Then you can download from Notification.
For me, I clean previous exported files and data from DB using this.
` protected function getHeaderActions(): array
{
return [
Actions\CreateAction::make()->disabled(!PropertyResource::handleVersion())
->label(
fn (): string =>
PropertyResource::handleVersion() ? 'Create property' : 'Reach demo limit (5 properties)'
)->icon('heroicon-o-plus')->keyBindings(['mod+n']),
Actions\ExportAction::make()->disabled(!PropertyResource::handleVersion())
->exporter(PropertyExporter::class)
->columnMapping(false)
->formats([
ExportFormat::Xlsx,
])->label('Export')->color('success')
->icon('carbon-document-export')->keyBindings(['mod+e'])
->before(function () {
$this->deleteOldExports();
}),
];
}
private function deleteOldExports()
{
$exports = Export::where('exporter', PropertyExporter::class)->get();
foreach ($exports as $export) {
$path = 'filament_exports/' . $export->id;
if (Storage::disk('public')->exists($path)) {
Storage::disk('public')->deleteDirectory($path);
}
$export->delete();
}
}
2 replies