浏览代码

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
                                 2 => "區塊文字",
85
                                 2 => "區塊文字",
86
                                 3 => "表格",
86
                                 3 => "表格",
87
                                 4 => "圖片",
87
                                 4 => "圖片",
88
+                                5 => "影片",
88
                             ])->label("")->default(1)->Live(),
89
                             ])->label("")->default(1)->Live(),
89
                             Group::make()->schema([
90
                             Group::make()->schema([
90
                                 Translate::make()->schema(fn (string $locale) => [
91
                                 Translate::make()->schema(fn (string $locale) => [
329
                                     ->orderColumn('order')
330
                                     ->orderColumn('order')
330
                                 ])
331
                                 ])
331
                             ])->visible(fn (Get $get):bool => $get("type") == 4),
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
                         ->relationship("paragraphs")
346
                         ->relationship("paragraphs")
334
                         ->addActionLabel('新增段落')
347
                         ->addActionLabel('新增段落')

+ 9
- 0
app/Http/Controllers/Api/EsgController.php 查看文件

135
                             }, $content["multiple_images"])
135
                             }, $content["multiple_images"])
136
                         ];
136
                         ];
137
                         break;
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
         }