Closed taha-hespress closed 1 year ago
@danharrin This issue still occur, when using Spatie Translatable, then tries to search on a table:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'json_extract(name, "$.en")' in 'where clause'
----
SELECT
count(*) AS aggregate
FROM
`products`
WHERE
(`products`.`deleted_at` IS NULL)
AND (
`json_extract(name, "$`.`en")` LIKE % a %
OR `initial_price` LIKE % a %
OR `quantity` LIKE % a %
OR `json_extract(name, "$`.`en")` LIKE % a %
)
Package filament/filament
Package Version v3.0.93
Laravel Version v10.31.0
Livewire Version v3.1.0
PHP Version V 8.2.11
@danharrin this issue still occur
With the same reproduction repo?
With the same reproduction repo?
no
We need a new issue with a new repo then
having same issue too, as https://github.com/filamentphp/filament/issues/7537#issuecomment-1805960402
I'm facing the same issue
Since this issue has been reported as resolved (https://github.com/filamentphp/filament/issues/7537#issuecomment-1807751819), please see my comment above and open a new issue with a new reproduction repp
Package
filament/filament
Package Version
v3.0.11
Laravel Version
v10.17.1
Livewire Version
v3.0.0-beta.7
PHP Version
PHP 8.2.3
Problem description
with fresh install of filament + Spatie Translatable Plugin, when trying to search in table with a translatable column, give this error :
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'json_extract(name, "$.en")' in 'where clause' SELECT count(*) AS aggregate FROM
patients
WHERE (json_extract(name, "$
.en")
LIKE %engl% ORtype
LIKE %engl%)Potential fix found
update in line 102 /filament/spatie-laravel-translatable-plugin/src/SpatieLaravelTranslatableContentDriver.php and make the column inside Expression
$caseAwareSearchColumn = $isCaseInsensitivityForced ? new Expression("lower({$column})") : $column;
to
$caseAwareSearchColumn = $isCaseInsensitivityForced ? new Expression("lower({$column})") : new Expression($column);
Expected behavior
the table search according to the local selected
Steps to reproduce
Reproduction repository
https://github.com/taha-hespress/filament-translatable-search-bug
Relevant log output
No response