filamentphp/filament

Attribute with name length is not giving the desired output when using ->searchable(isIndividual: true)

Open

#15073 opened on Dec 12, 2024

View on GitHub
 (1 comment) (0 reactions) (0 assignees)PHP (30,736 stars) (4,162 forks)batch import
bug in dependencyhelp wantedmedium priorityunconfirmed

Description

Package

filament/filament

Package Version

v3.2.130

Laravel Version

v.11.35.0

Livewire Version

No response

PHP Version

PHP 8.3

Problem description

When you have an attribute named length in the database and you use the ->searchable(isIndividual: true) in the tables of filament you get a zero in the search field and the search field is not working. When deleting the zero to filter, the zero keeps coming back.

image

Expected behavior

That the zero is not there and that I am able to filter individual on an attribute named length.

Steps to reproduce

  1. Create a table with a column that is named length with type integer or float
  2. Create a standard resource of the model
  3. Make the column length individual searchable
public static function table(Table $table): Table
    {
        return $table
            ->columns([
                Tables\Columns\TextColumn::make('id')
                    ->label('ID'),
                Tables\Columns\TextColumn::make('length')
                    ->suffix(' mm')
                    ->searchable(isIndividual: true)
                    ->sortable(),
                Tables\Columns\TextColumn::make('total_meters')
                    ->suffix(' m')
                    ->sortable(),
                Tables\Columns\TextColumn::make('supplier_reference')
                    ->label('Reference')
                    ->sortable(),
            ])
            ->filters([
                //
            ])
            ->actions([
                Tables\Actions\EditAction::make(),
            ])
            ->bulkActions([
                Tables\Actions\BulkActionGroup::make([
                    Tables\Actions\DeleteBulkAction::make(),
                ]),
            ]);
    }

Reproduction repository (issue will be closed if this is not valid)

https://github.com/Geoffry304/filament-length-attribute-issue

Relevant log output

No response

Contributor guide