mikebronner / laravel-model-caching

Eloquent model-caching made easy.
MIT License
2.24k stars 213 forks source link

Add some code to stop scopes from being applied twice. #358

Closed saernz closed 4 years ago

saernz commented 4 years ago

This should fix #289 by overriding the builders implementation of applyScopes() to make it check if scopes have been applied already before attempting to apply them again.

mikebronner commented 4 years ago

@saernz Thanks so much for this, this is awesome! I will take a look first thing in the morning.

saernz commented 4 years ago

@mikebronner Thanks for the merge man! That's weird there was that compatibility issue that the tests didn't pick up, thanks for fixing it all up.

mikebronner commented 4 years ago

I think it was because the tests weren't triggering the case where the scopes weren't applied yet. Will experiment with that a bit and see if we can't get a test to do that.