Explorar el Código

backend news category with default

padre
commit
e710408709
Se han modificado 1 ficheros con 1 adiciones y 2 borrados
  1. 1
    2
      app/Filament/Resources/NewsResource.php

+ 1
- 2
app/Filament/Resources/NewsResource.php Ver fichero

51
                         ->options(NewsCategory::get()->pluck("name","id"))
51
                         ->options(NewsCategory::get()->pluck("name","id"))
52
                         ->label("文章分類")
52
                         ->label("文章分類")
53
                         ->columnSpan(1)
53
                         ->columnSpan(1)
54
-                        ->default(1)
55
                         ->native(false)
54
                         ->native(false)
56
                         ->afterStateHydrated(function ($component, $state) {
55
                         ->afterStateHydrated(function ($component, $state) {
57
                             // ✅ 如果沒有值,設定為第一項
56
                             // ✅ 如果沒有值,設定為第一項
62
                                 }
61
                                 }
63
                             }
62
                             }
64
                         })
63
                         })
65
-                        ->hidden(),
64
+                        ->required(),
66
                     ])->columnSpanFull()->columns(2),
65
                     ])->columnSpanFull()->columns(2),
67
                     Group::make()->schema([
66
                     Group::make()->schema([
68
                         DatePicker::make('post_date')
67
                         DatePicker::make('post_date')