label(trans('filament-actions::export.modal.actions.export.label')); $this->icon('tabler-download'); $this->authorize(fn () => auth()->user()->can('export egg')); $this->modalHeading(fn (Egg $egg) => trans('filament-actions::export.modal.actions.export.label') . ' ' . $egg->name); $this->modalIcon($this->icon); $this->form([ Placeholder::make('') ->label(fn (Egg $egg) => trans('admin/egg.export.modal', ['egg' => $egg->name])), ]); $this->modalFooterActionsAlignment(Alignment::Center); $this->modalFooterActions([ Action::make('json') ->label(trans('admin/egg.export.as') . ' .json') ->action(fn (EggExporterService $service, Egg $egg) => response()->streamDownload(function () use ($service, $egg) { echo $service->handle($egg->id, EggFormat::JSON); }, 'egg-' . $egg->getKebabName() . '.json')) ->close(), Action::make('yaml') ->label(trans('admin/egg.export.as') . ' .yaml') ->action(fn (EggExporterService $service, Egg $egg) => response()->streamDownload(function () use ($service, $egg) { echo $service->handle($egg->id, EggFormat::YAML); }, 'egg-' . $egg->getKebabName() . '.yaml')) ->close(), ]); } }