ソースを参照

add video paragraphs setting

コミット
0ddca2fe5c
共有2 個のファイルを変更した22 個の追加0 個の削除を含む
  1. 13
    0
      app/Filament/Resources/EsgResource.php
  2. 9
    0
      app/Http/Controllers/Api/EsgController.php

+ 13
- 0
app/Filament/Resources/EsgResource.php ファイルの表示

@@ -85,6 +85,7 @@ class EsgResource extends Resource
85 85
                                 2 => "區塊文字",
86 86
                                 3 => "表格",
87 87
                                 4 => "圖片",
88
+                                5 => "影片",
88 89
                             ])->label("")->default(1)->Live(),
89 90
                             Group::make()->schema([
90 91
                                 Translate::make()->schema(fn (string $locale) => [
@@ -329,6 +330,18 @@ class EsgResource extends Resource
329 330
                                     ->orderColumn('order')
330 331
                                 ])
331 332
                             ])->visible(fn (Get $get):bool => $get("type") == 4),
333
+                            Group::make()->schema([
334
+                                Section::make("")->schema([
335
+                                    FileUpload::make('content.video_img')->label("影片底圖")
336
+                                    ->disk("public")
337
+                                    ->directory("esg/paragraphVideo")
338
+                                    ->helperText('建議寬高限制為:2000*720px,出血寬度720px,主要圖像範圍為:1280*720px,檔案大小限制為1M以下')->maxSize('1024'),
339
+                                    TextInput::make('content.link')->label("網址")->nullable(),
340
+                                    Translate::make()->schema(fn (string $locale) => [
341
+                                        TextInput::make('content.video_alt')->label("影片註文"),
342
+                                    ])->locales(["zh_TW", "en"])
343
+                                ]),
344
+                            ])->visible(fn (Get $get):bool => $get("type") == 5),
332 345
                         ])
333 346
                         ->relationship("paragraphs")
334 347
                         ->addActionLabel('新增段落')

+ 9
- 0
app/Http/Controllers/Api/EsgController.php ファイルの表示

@@ -135,6 +135,15 @@ class EsgController extends Controller
135 135
                             }, $content["multiple_images"])
136 136
                         ];
137 137
                         break;
138
+                    case "5":
139
+                        $output[] = [
140
+                            "type" => "video",
141
+                            "is_yt" => true,
142
+                            "video_img_url" => Storage::disk("public")->url($content["video_img"]),
143
+                            "video_url" => $content["link"],
144
+                            "content" => $content["video_alt"][$locate]
145
+                        ];
146
+                        break;
138 147
                 }
139 148
             }
140 149
         }