UTF8 problem
hojabbr opened this issue · 1 comments
hojabbr commented
can't do a search in Persian or Arabic
SQLSTATE[HY000]: General error: 1271 Illegal mix of collations for operation 'like' (SQL: select count(*) as aggregate from
items where (
idLIKE %سلام% OR
titleLIKE %سلام% OR
introLIKE %سلام% OR
descriptionLIKE %سلام% OR
thumbnailLIKE %سلام% OR
imagesLIKE %سلام% OR
priceLIKE %سلام% OR
statusLIKE %سلام% OR
user_idLIKE %سلام% OR
created_atLIKE %سلام% OR
updated_atLIKE %سلام% OR
deleted_atLIKE %سلام% OR
slugLIKE %سلام%) and
items.
deleted_at is null)
hojabbr commented
Found the problem, the date fields are causing the problem so excluded them with a function within the Model:
public function toSearchableArray()
{
return $this->only('id', 'title', 'intro', 'description');
}