label('归档模板'); $this->icon('heroicon-o-archive-box'); $this->color('warning'); $this->requiresConfirmation(); $this->modalHeading('归档 SOP 模板'); $this->modalDescription('归档后,模板将不再对用户显示。确定要归档吗?'); $this->modalSubmitActionLabel('确认归档'); $this->visible(function ($record) { return $record instanceof SopTemplate && $record->status === 'published'; }); $this->action(function (SopTemplate $record) { $record->update([ 'status' => 'archived', ]); Notification::make() ->title('归档成功') ->body('SOP 模板已成功归档') ->success() ->send(); }); } }