matchish / laravel-scout-elasticsearch

Search among multiple models with ElasticSearch and Laravel Scout
MIT License
702 stars 113 forks source link

[BUG] Bulk update error when saving with boolean #245

Closed hamedgasemi200 closed 1 year ago

hamedgasemi200 commented 1 year ago

I get Bulk update error while saving whenever toSearchableArray has a boolean record.

    public function toSearchableArray(): array
    {
        return $this->only([
            ...
            'comments_status' => true, // Causes to crash
        ]);
    }
hamedgasemi200 commented 1 year ago

Solved it by:

    protected $casts = [
        'comment_status' => 'boolean',
    ];