requiresConfirmation(); $this->label(__('filament-actions::dissociate.single.label')); $this->modalHeading(fn (): string => __('filament-actions::dissociate.single.modal.heading', ['label' => $this->getRecordTitle()])); $this->modalSubmitActionLabel(__('filament-actions::dissociate.single.modal.actions.dissociate.label')); $this->successNotificationTitle(__('filament-actions::dissociate.single.notifications.dissociated.title')); $this->defaultColor('danger'); $this->icon(FilamentIcon::resolve('actions::dissociate-action') ?? 'heroicon-m-x-mark'); $this->modalIcon(FilamentIcon::resolve('actions::dissociate-action.modal') ?? 'heroicon-o-x-mark'); $this->action(function (): void { $this->process(function (Model $record, Table $table): void { /** @var BelongsTo $inverseRelationship */ $inverseRelationship = $table->getInverseRelationshipFor($record); $inverseRelationship->dissociate(); $record->save(); }); $this->success(); }); } }