laravel / scout

Laravel Scout provides a driver based solution to searching your Eloquent models.
https://laravel.com/docs/scout
MIT License
1.54k stars 327 forks source link

Saving a Soft-Deleted Eloquent Model makes it searchable again #834

Closed matrad closed 2 months ago

matrad commented 3 months ago

Scout Version

10.1.0

Scout Driver

Algolia

Laravel Version

11.x

PHP Version

8.1.4

Database Driver & Version

No response

SDK Version

No response

Meilisearch CLI Version

No response

Description

When we retrieve a soft-deleted model from the Database and Save this model, it becomes again searchable.

Steps To Reproduce

github-actions[bot] commented 3 months ago

Thank you for reporting this issue!

As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub.

If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team.

Thank you!

Boorinio commented 3 months ago

Hey @matrad There is an example in the repo with the following image

Do you have the trashed check in the shouldBeSearchable in your model? Cause from what I am seeing it should take care of it from the observer.

driesvints commented 2 months ago

Thanks @Boorinio