Okipa / laravel-table

Generate tables from Eloquent models.
MIT License
532 stars 64 forks source link

Searchable by integer column #74

Closed dirtyfrank23 closed 2 years ago

dirtyfrank23 commented 3 years ago

Hello, i've been experimenting with your tables for a bit and it's great but I just noticed that I cannot search by an integer field. I see that you use lower() and cast the searchable columns to text. Could you possibly add the feature to search by a numeric or integer field ?

Okipa commented 3 years ago

Hi @dirtyfrank23, sorry for the delayed answer.

Would you mind to precise your use case ? The search feature provides a case insensitive and partial search on text but there is ways to achieve alternative filtering if you need to.

dirtyfrank23 commented 3 years ago

Hi Okipa, thanks for replying. I have the table below and I'm trying to filter by column 'Number' (integer in DB) and am receiving the following error in Laravel.

invoice_table_query

invoice_table_columns

invoices_table

invoices_table_error

Okipa commented 3 years ago

@dirtyfrank23 I couldn't reproduce your issue with a simple test case. In fact it is working with a basic integer field.

I believe this is an issue related to your specific sql query. In your error message it is recommended to cast your invoice_number in a string, did you try that ? I think this could actually work.

The lowercase is needed on the package size to provide a partial and insensitive case search behavior and it cannot be touched without including some breaking changes.

Okipa commented 3 years ago

I've created a PR to add this case verification : https://github.com/Okipa/laravel-table/pull/75/files

Okipa commented 2 years ago

Closing as there is no activity here.