Andrew 2 ヶ月 前
コミット
511bdb60cf

+ 2
- 1
app/Filament/Resources/NewsResource.php ファイルの表示

@@ -70,6 +70,7 @@ class NewsResource extends Resource
70 70
                         DatePicker::make('post_date')->label('發佈日')
71 71
                             ->native(false)
72 72
                             ->closeOnDateSelection()
73
+                            ->required()
73 74
                             ->columnSpan(1),
74 75
                         Translate::make()->schema(fn(string $locale) => [
75 76
                             TextInput::make('title')->required($locale == 'zh_TW')->label('標題')->columnSpan(1),
@@ -108,7 +109,7 @@ class NewsResource extends Resource
108 109
                         FileUpload::make('meta_img')->label('放大預覽圖')
109 110
                             ->directory('news/seo')
110 111
                             ->columnSpan(1)
111
-                            ->acceptedFileTypes(['image/jpeg', 'image/jpg', 'image/png', 'image/webp'])->required()->imageEditor()
112
+                            ->acceptedFileTypes(['image/jpeg', 'image/jpg', 'image/png', 'image/webp'])->imageEditor()
112 113
                             ->id('Seo'),
113 114
                     ]),
114 115
                     Tab::make('內文編輯')->schema([

+ 2
- 2
database/migrations/2025_09_04_072958_create_banners_table.php ファイルの表示

@@ -15,8 +15,8 @@ return new class extends Migration
15 15
             $table->id();
16 16
             $table->json("title")->nullable()->comment("大字標題");
17 17
             $table->json("content")->nullable()->comment("小標字體");
18
-            $table->string("img_url")->comment("image url");
19
-            $table->json("img_alt")->comment("alt");
18
+            $table->string("img_url")->nullable()->comment("image url");
19
+            $table->json("img_alt")->nullable()->comment("alt");
20 20
             $table->integer("order")->default(0);
21 21
             $table->boolean("visible")->default(1);
22 22
             $table->timestamps();

+ 1
- 1
database/migrations/2025_11_06_064142_alter_table_banners_add_column_mobile_img.php ファイルの表示

@@ -12,7 +12,7 @@ return new class extends Migration
12 12
     public function up(): void
13 13
     {
14 14
         Schema::table("banners", function (Blueprint $table) {
15
-            $table->string("mobile_img")->comment("手機版圖片");
15
+            $table->string("mobile_img")->nullable()->comment("手機版圖片");
16 16
         });
17 17
     }
18 18