Browse Source

badge title unique

Andrew 3 months ago
parent
commit
2f12b79232
1 changed files with 7 additions and 1 deletions
  1. 7
    1
      app/Filament/Resources/BadgeResource.php

+ 7
- 1
app/Filament/Resources/BadgeResource.php View File

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([