getCreateFormAction(), $this->getCreateAnotherFormAction(), Action::make('Create and Export')->action('saveAndExport')->color('success'), $this->getCancelFormAction() ]; } /** * @throws Throwable */ public function saveAndExport(): void { $this->authorizeAccess(); try { DB::beginTransaction(); $this->callHook('beforeValidate'); $data = $this->form->getState(); $this->callHook('afterValidate'); $data = $this->mutateFormDataBeforeCreate($data); $this->callHook('beforeCreate'); $this->record = $this->handleRecordCreation($data); $this->form->model($this->getRecord())->saveRelationships(); $this->callHook('afterCreate'); DB::commit(); } catch (Halt $exception) { $exception->shouldRollbackDatabaseTransaction() ? DB::rollBack() : DB::commit(); return; } catch (Throwable $exception) { DB::rollBack(); throw $exception; } $this->rememberData(); TransmittalResource::exportTransmittal([$this->record->id]); Notification::make() ->success() ->title('Transmittal Was Created Successfully!, Check your notification for file download link') ->send(); } public function getCreatedNotificationMessage(): ?string { return 'Transmittal Was Created Successfully!'; // TODO: Change the autogenerated stub } protected function getRedirectUrl(): string { return $this->previousUrl ?? $this->getResource()::getUrl('index'); } }