Filament 详情页隐藏 RelationManager 表单提交按钮
AI 提问
app/Filament/Resources/Health/ChannelSpeakerConfigResource/RelationManagers/ThemeConfigRelationManager.php
给我分析一下,RelationManager 在详情 view 访问时
Tables\Actions\EditAction::make(), Tables\Actions\DeleteAction::make()
修改,删除 被隐藏了。是用了什么方法。
回答结果
隐藏原因
当满足以下条件时,actions 会被隐藏:
当前页面是 ViewRecord 的子类(详情页)
isReadOnly() 返回 true,导致 authorize() 返回 false,actions 被隐藏
解决问题
return $table ->header(view('filament.relation-managers.ai-config-header', [ 'initialAiVoice' => $this->aiVoice, 'initialWakeWord' => $this->wakeWord, 'initialIdentityName' => $this->identityName, 'initialWelcomePhrase' => $this->welcomePhrase, 'aiVoiceProperty' => 'aiVoice', 'wakeWordProperty' => 'wakeWord', 'identityNameProperty' => 'identityName', 'welcomePhraseProperty' => 'welcomePhrase', 'saveMethod' => 'saveAiConfig', 'isReadOnly' => $this->isReadOnly(), // 是否只读 ])) 本作品采用《CC 协议》,转载必须注明作者和本文链接
关于 LearnKu