mikebronner / laravel-model-caching

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

relation limit offset #320

Closed alexinteam closed 4 years ago

alexinteam commented 4 years ago

Describe the bug Found a bug wher using limit, offset in relation

Qry

Category::with(['posts' => function ($q) use ($offset, $limit) {
                $q->where('active',true)
                    ->orderBy('date', 'DESC')
                    ->offset($offset)
                    ->limit($limit);
            }])
            ->first();

so my qry ignored limit, offset totally.

PS disabling model caching returns correct data

Thanks.

mikebronner commented 4 years ago

Thanks for reporting this! I will try to recreate the issue and see what's going on.

mikebronner commented 4 years ago

@alexinteam I was unable to replicate the issue. I created a new test: https://github.com/GeneaLabs/laravel-model-caching/blob/master/tests/Integration/CachedBuilder/WithTest.php#L11

Could you provide a PR with a failing test?

alexinteam commented 4 years ago

Sorry, I researched. It wasn't your problem. Closing

mikebronner commented 4 years ago

Good to hear! :)