Andrew vor 2 Wochen
Ursprung
Commit
1fd8fcfb43

+ 8
- 0
app/Filament/Resources/ProjectResource.php Datei anzeigen

@@ -58,6 +58,14 @@ class ProjectResource extends Resource
58 58
                         ->actions([
59 59
                             app(DeepLService::class)->createTranslationAction('Main', ['name', 'sub_name']),
60 60
                         ])->columnSpanFull()->id('main'),
61
+                    Translate::make()->schema(fn(string $locale) => [
62
+                        Textarea::make('seo_description')->label('Meta Description'),
63
+                        TextInput::make('seo_keywords')->label('Meta Keywords'),
64
+                    ])
65
+                        ->locales(['zh_TW', 'en'])
66
+                        ->actions([
67
+                            app(DeepLService::class)->createTranslationAction('seo', ['seo_description', 'seo_keywords']),
68
+                        ])->columnSpanFull()->id('seo'),
61 69
                     Select::make('tags')
62 70
                         ->multiple()
63 71
                         ->relationship('tags', 'name')

+ 1
- 1
app/Models/Project.php Datei anzeigen

@@ -15,7 +15,7 @@ class Project extends Model
15 15
     protected $guarded = ['id'];
16 16
 
17 17
     protected $translatable = ['name', 'sub_name', 'summaries', 'img_alt', 'address', 'floor_plan',
18
-        'building_structure', 'design_unit', 'contact', 'district',
18
+        'building_structure', 'design_unit', 'contact', 'district', 'seo_description', 'seo_keywords',
19 19
     ];
20 20
 
21 21
     protected $casts = ['img_url' => 'array', 'mobile_img_url' => 'array'];

+ 29
- 0
database/migrations/2026_03_23_104229_add_seo_columns_to_projects_table.php Datei anzeigen

@@ -0,0 +1,29 @@
1
+<?php
2
+
3
+use Illuminate\Database\Migrations\Migration;
4
+use Illuminate\Database\Schema\Blueprint;
5
+use Illuminate\Support\Facades\Schema;
6
+
7
+return new class extends Migration
8
+{
9
+    /**
10
+     * Run the migrations.
11
+     */
12
+    public function up(): void
13
+    {
14
+        Schema::table('projects', function (Blueprint $table) {
15
+            $table->json('seo_description')->nullable()->after('visible');
16
+            $table->json('seo_keywords')->nullable()->after('seo_description');
17
+        });
18
+    }
19
+
20
+    /**
21
+     * Reverse the migrations.
22
+     */
23
+    public function down(): void
24
+    {
25
+        Schema::table('projects', function (Blueprint $table) {
26
+            $table->dropColumn(['seo_description', 'seo_keywords']);
27
+        });
28
+    }
29
+};