['required', 'file', 'mimetypes:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'] ]; } public function import(): void { if (!$this->importClass) return; $filePath = $this->file->store('excel/import/' . $this->resourceName, ['disk' => 'local']); $recipentEmail = auth('web')->user()->email; $importId = Str::uuid()->toString(); $importInstance = new $this->importClass(); Excel::queueImport($importInstance, $filePath)->chain([ new NotifyImportComplete(recipientEmail: $recipentEmail) ]); $this->success(__('ui.excel.import.success')); $this->dispatch('hide-excel-import-modal'); } #[On('export-excel')] public function export(): void { if (!$this->exportClass) return; $recipentEmail = auth('web')->user()->email; $storagePath = 'excel/export/' . $this->resourceName . '_' . time() . '.xlsx'; $exportInstance = new $this->exportClass(); $styledExport = new StyledExport($exportInstance); \Maatwebsite\Excel\Facades\Excel::queue($styledExport, $storagePath)->chain([ new NotifyExportReady( recipientEmail: $recipentEmail, filePath: $storagePath, downloadName: 'Report_' . $this->resourceName, ) ]); $this->success(__('ui.excel.export.success')); } public function hide(): void { $this->reset('file'); $this->dispatch('filepond-reset-file'); $this->resetValidation(); $this->resetErrorBag(); } }; ?>
@if($importClass) @push('scripts') @vite(['resources/js/plugin/filepond.js']) @endpush @endif