Quellcode durchsuchen

badge title unique

Andrew vor 1 Monat
Ursprung
Commit
2f12b79232
1 geänderte Dateien mit 7 neuen und 1 gelöschten Zeilen
  1. 7
    1
      app/Filament/Resources/BadgeResource.php

+ 7
- 1
app/Filament/Resources/BadgeResource.php Datei anzeigen

46
                     Group::make()->schema([
46
                     Group::make()->schema([
47
                         Group::make()->schema([
47
                         Group::make()->schema([
48
                             Translate::make()->schema(fn (string $locale) => [
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
                                 ->locales(['zh_TW', 'en'])
57
                                 ->locales(['zh_TW', 'en'])
52
                                 ->actions([
58
                                 ->actions([