Andrew 1 месяц назад
Родитель
Сommit
2f12b79232
1 измененных файлов: 7 добавлений и 1 удалений
  1. 7
    1
      app/Filament/Resources/BadgeResource.php

+ 7
- 1
app/Filament/Resources/BadgeResource.php Просмотреть файл

@@ -46,7 +46,13 @@ class BadgeResource extends Resource
46 46
                     Group::make()->schema([
47 47
                         Group::make()->schema([
48 48
                             Translate::make()->schema(fn (string $locale) => [
49
-                                TextInput::make('title')->unique()->required($locale == 'zh_TW')->maxLength(40)->label('徽章標題'),
49
+                                TextInput::make('title')->required($locale == 'zh_TW')
50
+                                    ->unique(
51
+                                        table: Badge::class,  // Your model class
52
+                                        column: 'title',      // The translatable JSON column
53
+                                        ignoreRecord: true   // Ignore current record on updates
54
+                                    )
55
+                                    ->maxLength(40)->label('徽章標題'),
50 56
                             ])
51 57
                                 ->locales(['zh_TW', 'en'])
52 58
                                 ->actions([