Closed
Description
It seems that when performing a second (different) query for a Model, the (cached) result of the previous query is always returned...
Steps to reproduce
- Clean install of Laravel 5.6.9 and package version 0.2.47
- Have 3 instances of a model (e.g.: App\Car) stored in the database
- Call App\Car::all()
- Call App\Car::first()
Result
- Result of step 3: Collection of 3 Car models
- Result of step 4: cached result of step 2 is returned (thus giving a collection with 3 Cars, instead of a single Car Model)
The same happens when doing something like:
- Call App\Car::where('id', '<', 100)->get()
- Call App\Car::where('id', '<', 100)->first()
or
- $car = new App\Car
- $car->all()
- $car->first()
Results are the same for Cache drivers "redis" and "file"
I did not change any other configuration, just added the Cachable trait to the Model
Maybe I'm missing something obvious, since this seems to be quite a big issue, but I haven't seen any one else report it...