- 
                Notifications
    You must be signed in to change notification settings 
- Fork 232
Closed
Description
Describe the bug
I guess that lmc not adding additional conditions to cache key in morph relations. Look at query. Product has Price (morphable). LMC returns same row/object that was cached first for different conditions. For example, if retail price was cached first, LMC will return retail price, when you are expecting wholesale price. And vice versa, if wholesale price was cached first, LMC will return wholesale price, when you are expecting retail price.
Eloquent Query
Please provide the complete eloquent query that caused the bug, for example:
$products = Product
            ::with([
                'price' => function($query){
                    $query->where('type', request()->has('wholesale') ? 'wholesale' : 'retail');
                }
            ])
            ->where('category_id', $current)
            ->get();Environment
- PHP: 7.1.*
- OS: macOS latest
- Laravel: 5.8.*
- Model Caching: latest
Additional context
I created new testing repo to reproduce the problem, instruction in readme https://github.com/smapod/lmc.
Thanks!