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

fix: permit makeSearchableUsing to realy modify the collection #808

Closed ArnaudBan closed 6 months ago

ArnaudBan commented 6 months ago

The makeSearchableUsing method is aime for modifying the collection.

I wanted to use the load method on my current collection but for that it need to assign the return to the current object.

Without this changes you can't really modify the collection, all modifications are not passe to the last call ->update($this->models)

driesvints commented 6 months ago

There's no tests here.

ArnaudBan commented 6 months ago

You are of course rigth. I will try to add tests as soon as i find how to do that. If you have some documentation to setup this package on my machine and run the tests it would help me a lot otherwise a will find how to do this. Thank you.

taylorotwell commented 6 months ago

Sorry, I'm not sure why they wouldn't be modified? The load method loads the relationships onto the model instance and objects are by-reference in PHP.