Я хочу изменить ярлык:
Фактический результат:
Отображается кнопка «Удалить из авторов» (как при удалении нескольких авторов)< /p>
Ожидаемый результат:
отображается только кнопка «Корзина».
count($records) === 1 ? __('Корзина'): __('Удалить от создателей');
public static function table(Table $table): Table { return $table ->modifyQueryUsing(static function ($query) { $query->leftJoin('model_has_roles', 'model_has_roles.model_id', '=', 'users.id') ->where('model_has_roles.role_id', '=', UserRole::CREATOR->value); }) ->columns([ TextColumn::make('name') ->searchable() ->sortable(), ]) ->actions([ Action::make('trash') ->label('') ->icon('heroicon-o-trash') ->action(static function (User $user) { return $user->removeRole(UserRole::CREATOR->value); }), ]) ->bulkActions([ DeleteBulkAction::make() ->successNotificationTitle(__('Removed')) ->label(__('Remove from creators')) ->modalHeading(__('Remove users')) ->modalSubmitActionLabel(__('Yes, remove it')) ->action(static function (Collection $records) { $records->each(static function ($user) { assert($user instanceof User); $user->removeRole(UserRole::CREATOR->value); }); }), ]); }
public static function getPages(): array { return [ 'index' => Pages\ListCreators::route('/'), ]; } } [/code] Я попробовал использовать тернарную операцию и обратный вызов в своей метке.