schema([ Forms\Components\TextInput::make('name') ->label('Name') ->required() ->maxLength(255) ->disabled(), Forms\Components\TextInput::make('email') ->label('Email') ->email() ->required() ->maxLength(255) ->disabled(), Forms\Components\TextInput::make('subject') ->label('Subject') ->maxLength(255) ->disabled(), Forms\Components\Textarea::make('message') ->label('Message') ->required() ->rows(5) ->maxLength(2000) ->disabled(), Forms\Components\Select::make('status') ->label('Status') ->options([ 'unread' => 'Unread', 'read' => 'Read', 'replied' => 'Replied', 'archived' => 'Archived', ]) ->default('unread') ->required(), Forms\Components\Textarea::make('admin_notes') ->label('Admin Notes') ->rows(3) ->maxLength(1000), Forms\Components\DateTimePicker::make('read_at') ->label('Read At'), Forms\Components\DateTimePicker::make('replied_at') ->label('Replied At'), Forms\Components\TextInput::make('ip_address') ->label('IP Address') ->disabled(), Forms\Components\Textarea::make('user_agent') ->label('User Agent') ->rows(2) ->disabled(), ]); } public static function table(Table $table): Table { return $table ->columns([ Tables\Columns\TextColumn::make('name') ->searchable() ->sortable(), Tables\Columns\TextColumn::make('email') ->searchable() ->sortable(), Tables\Columns\TextColumn::make('subject') ->searchable() ->limit(50), Tables\Columns\BadgeColumn::make('status') ->colors([ 'danger' => 'unread', 'warning' => 'read', 'success' => 'replied', 'gray' => 'archived', ]), Tables\Columns\TextColumn::make('created_at') ->label('Submitted') ->dateTime() ->sortable(), Tables\Columns\TextColumn::make('read_at') ->label('Read') ->dateTime() ->sortable(), ]) ->filters([ Tables\Filters\SelectFilter::make('status') ->options([ 'unread' => 'Unread', 'read' => 'Read', 'replied' => 'Replied', 'archived' => 'Archived', ]), ]) ->actions([ Tables\Actions\EditAction::make(), ]) ->bulkActions([ Tables\Actions\DeleteBulkAction::make(), ]) ->defaultSort('created_at', 'desc'); } public static function getPages(): array { return [ 'index' => Pages\ListContactMessages::route('/'), 'edit' => Pages\EditContactMessage::route('/{record}/edit'), ]; } public static function getNavigationBadge(): ?string { return static::getModel()::where('status', 'unread')->count(); } }