Appends array is searched for in columns
Yorannn opened this issue · 3 comments
Currently when you use the protected $appends array on your model the plugin searches for these names in your database as well resulting in Column not found: 1054
I know it's closed, but I had the same issue. Solved it by applying this function in my class:
public function toSearchableArray()
{
$array = $this->toArray();
unset($array['pngs']);
return $array;
}
... where 'pngs' is a appended field.
Why was this closed? 🤔
This bug hasn't been fixed yet. Although @johankladder's workaround works, having the search driver ignore $appends
value would be the correct solution. $appends
only defines accessors to append to the model's array form, and has nothing to do with the actual database structure.
Tried to use Scout with the database engine in my Laravel 9 app using appends and got this error. I'm confused, Scout is listed as official package for Laravel 10 even, yet a 4,5 years old bug still exists. Could someone explain to me why that is and if it's recommended at all using Scout? Seems like riding a dead horse but I'm open to other views.