cache bug fix

This commit is contained in:
2020-08-24 18:57:43 +05:00
parent 4bc1f5448e
commit d3ae5de10b
3 changed files with 6 additions and 3 deletions

View File

@@ -30,7 +30,8 @@ class TopicsAPIController extends Controller
*/
public function show(Topic $topic)
{
return Cache::remember('topic_'.$topic->slug, 300, function () use ($topic) {
$currentPage = request()->get('page',1);
return Cache::remember($topic->slug. '_'.$currentPage, 300, function () use ($topic) {
return response()->json([
'topic' => new TopicResource($topic),
'articles' => $topic->articles()->with('source')->latest('published_date')->paginate(8)