|
|
@@ -177,6 +177,14 @@ class ProjectResource extends Resource
|
|
177
|
177
|
TextInput::make('offical_link')->label('官網連結'),
|
|
178
|
178
|
])->columnSpanFull(),
|
|
179
|
179
|
Repeater::make('spaceInfos')->label('')->schema([
|
|
|
180
|
+ TextInput::make('spaceInfos_item_key')
|
|
|
181
|
+ ->default(fn () => Str::random())
|
|
|
182
|
+ ->hidden()
|
|
|
183
|
+ ->afterStateHydrated(function (TextInput $component, $state) {
|
|
|
184
|
+ if (empty($state)) {
|
|
|
185
|
+ $component->state(Str::random());
|
|
|
186
|
+ }
|
|
|
187
|
+ }),
|
|
180
|
188
|
Translate::make()->schema(fn (string $locale) => [
|
|
181
|
189
|
TextInput::make('title')->label('標題')->columnSpanFull(),
|
|
182
|
190
|
Textarea::make('content')->label('內文')->columnSpanFull(),
|
|
|
@@ -185,7 +193,7 @@ class ProjectResource extends Resource
|
|
185
|
193
|
->actions([
|
|
186
|
194
|
app(DeepLService::class)->createTranslationAction('spaceInfos', ['title', 'content']),
|
|
187
|
195
|
])->columnSpanFull()
|
|
188
|
|
- ->id(fn ($get) => 'spaceInfos_'.$get('item_key')),
|
|
|
196
|
+ ->id(fn ($get) => 'spaceInfos_'.$get('spaceInfos_item_key')),
|
|
189
|
197
|
])
|
|
190
|
198
|
->relationship('spaceInfos')
|
|
191
|
199
|
->label('')
|