22
33namespace Codedor \FilamentRedirects \Filament ;
44
5+ use Codedor \FilamentRedirects \Enums \RedirectStatus ;
56use Codedor \FilamentRedirects \Filament \RedirectResource \Pages \ManageRedirects ;
67use Filament \Forms ;
78use Filament \Forms \Form ;
@@ -24,25 +25,26 @@ public static function form(Form $form): Form
2425 return $ form
2526 ->schema ([
2627 Forms \Components \TextInput::make ('from ' )
28+ ->label (__ ('filament-redirects::admin.from ' ))
2729 ->rules (config ('filament-redirects.input-validation ' , ['required ' ]))
2830 ->required (),
2931
3032 Forms \Components \TextInput::make ('to ' )
33+ ->label (__ ('filament-redirects::admin.to ' ))
3134 ->rules (config ('filament-redirects.input-validation ' , ['required ' ]))
3235 ->required (),
3336
3437 Forms \Components \Select::make ('status ' )
38+ ->label (__ ('filament-redirects::admin.status ' ))
3539 ->required ()
36- ->options ([
37- 301 => __ ('301 - Permanent redirect ' ),
38- 302 => __ ('302 - Temporary redirect ' ),
39- 410 => __ ('410 - Gone (for page that once existed, but is gone now) ' ),
40- ]),
40+ ->options (RedirectStatus::class),
4141
4242 Forms \Components \Toggle::make ('pass_query_string ' )
43+ ->label (__ ('filament-redirects::admin.pass query string ' ))
4344 ->default (false ),
4445
4546 Forms \Components \Toggle::make ('online ' )
47+ ->label (__ ('filament-redirects::admin.online ' ))
4648 ->default (false ),
4749
4850 ]);
@@ -53,12 +55,18 @@ public static function table(Table $table): Table
5355 return $ table
5456 ->columns ([
5557 Tables \Columns \TextColumn::make ('from ' )
58+ ->label (__ ('filament-redirects::admin.from ' ))
5659 ->searchable ()
5760 ->url (fn ($ record ) => Str::replace ('* ' , '' , $ record ->from ), true ),
61+
5862 Tables \Columns \TextColumn::make ('to ' )
63+ ->label (__ ('filament-redirects::admin.to ' ))
5964 ->searchable ()
6065 ->url (fn ($ record ) => Str::replace ('* ' , '' , $ record ->to ), true ),
61- Tables \Columns \TextColumn::make ('status ' ),
66+
67+ Tables \Columns \TextColumn::make ('status ' )
68+ ->label (__ ('filament-redirects::admin.status ' ))
69+ ->formatStateUsing (fn (int $ state ): string => RedirectStatus::tryFrom ($ state )->getLabel ()),
6270 ])
6371 ->filters ([
6472 //
0 commit comments