Przeglądaj źródła

badge title unique

Andrew 1 miesiąc temu
rodzic
commit
a531dbb054
1 zmienionych plików z 3 dodań i 3 usunięć
  1. 3
    3
      app/Filament/Resources/BadgeResource.php

+ 3
- 3
app/Filament/Resources/BadgeResource.php Wyświetl plik

48
                             Translate::make()->schema(fn (string $locale) => [
48
                             Translate::make()->schema(fn (string $locale) => [
49
                                 TextInput::make('title')->required($locale == 'zh_TW')
49
                                 TextInput::make('title')->required($locale == 'zh_TW')
50
                                     ->unique(
50
                                     ->unique(
51
-                                        table: Badge::class,  // Your model class
52
-                                        column: 'title',      // The translatable JSON column
53
-                                        ignoreRecord: true   // Ignore current record on updates
51
+                                        table: 'badges',
52
+                                        column: 'title->' . $locale,
53
+                                        ignoreRecord: true
54
                                     )
54
                                     )
55
                                     ->maxLength(40)->label('徽章標題'),
55
                                     ->maxLength(40)->label('徽章標題'),
56
                             ])
56
                             ])