|
10 | 10 | use Filament\Resources\Resource; |
11 | 11 | use Filament\Tables\Actions\DeleteBulkAction; |
12 | 12 | use Filament\Tables\Actions\EditAction; |
| 13 | +use Filament\Tables\Columns\IconColumn; |
13 | 14 | use Filament\Tables\Columns\TextColumn; |
14 | 15 | use Filament\Tables\Table; |
15 | 16 | use Illuminate\Support\Facades\Config; |
@@ -39,8 +40,10 @@ public static function form(Form $form): Form |
39 | 40 | ->columnSpan(2), |
40 | 41 | TextInput::make('token') |
41 | 42 | ->label(__('login-link::translations.token')) |
42 | | - ->maxLength(255), |
| 43 | + ->maxLength(255) |
| 44 | + ->columnSpan(2), |
43 | 45 | DateTimePicker::make('expires_at'), |
| 46 | + DateTimePicker::make('used_at'), |
44 | 47 | Select::make('user_type') |
45 | 48 | ->options(function () { |
46 | 49 | $models = Config::get('login-link.user_models', []); |
@@ -70,24 +73,28 @@ public static function table(Table $table): Table |
70 | 73 | { |
71 | 74 | return $table |
72 | 75 | ->columns([ |
| 76 | + IconColumn::make('used') |
| 77 | + ->label('Valid') |
| 78 | + ->icons([ |
| 79 | + 'heroicon-o-x-circle' => fn ($record) => empty($record->used_at), |
| 80 | + 'heroicon-o-check-circle' => fn ($record) => ! empty($record->used_at), |
| 81 | + ]) |
| 82 | + ->tooltip(fn ($record) => empty($record->used_at) ? 'Not Used' : 'Used') |
| 83 | + ->sortable(), |
73 | 84 | TextColumn::make('email') |
74 | 85 | ->label(__('login-link::translations.email')) |
75 | 86 | ->sortable(), |
76 | | - TextColumn::make('token') |
77 | | - ->label(__('login-link::translations.token')) |
78 | | - ->sortable(), |
79 | | - TextColumn::make('expires_at') |
| 87 | + TextColumn::make('created_at') |
80 | 88 | ->label(__('login-link::translations.expires_at')) |
81 | | - ->sortable(), |
82 | | - TextColumn::make('user_agent') |
83 | | - ->label(__('login-link::translations.user_agent')) |
| 89 | + ->since() |
84 | 90 | ->sortable(), |
85 | 91 | TextColumn::make('expires_at') |
86 | 92 | ->label(__('login-link::translations.expires_at')) |
87 | 93 | ->since() |
88 | 94 | ->sortable(), |
89 | | - TextColumn::make('ip_address') |
90 | | - ->label(__('login-link::translations.ip_address')) |
| 95 | + TextColumn::make('used_at') |
| 96 | + ->label(__('login-link::translations.used_at')) |
| 97 | + ->since() |
91 | 98 | ->sortable(), |
92 | 99 | TextColumn::make('user_type') |
93 | 100 | ->label(__('login-link::translations.user_type')) |
|
0 commit comments