Laravel/Filament:不在关系管理器上显示“创建并创建另一个”按钮

问题描述 投票:0回答:1

假设我有一个带有表单的 ProductResource。当我创建产品时,会出现一个带有“创建并创建另一个”的按钮。我只想要“创建”按钮,因此在 ProductResource -> Pages -> CreateProduct.php 中添加“protected static bool $canCreateAnother = false;”现在,“创建并创建另一个”按钮未显示(正确)。我还有 CategoryResource 和 ProductsRelationManager。我也想在 ProductsRelationManager 中隐藏“创建并创建另一个”,但由于关系管理器没有页面,我无法添加“protected static bool $canCreateAnother = false;”到代码。

是否可以在关系管理器中隐藏此按钮?

laravel-filament
1个回答
0
投票

您可以在 ProductsRelationManager 中使用此代码

->headerActions([
    Tables\Actions\CreateAction::make()
      ->createAnother(false)
])

我的filament版本是3.2.69

© www.soinside.com 2019 - 2024. All rights reserved.