user(); if (! $user) { abort(403); } $hits = 33; $currentPage = max(1, (int) $request->query('page', 1)); $base = ArtworkComment::with(['user', 'artwork']) ->whereHas('artwork', function ($q) use ($user) { $q->where('user_id', $user->id)->where('is_approved', true); }) ->orderByDesc('created_at'); $comments = $base->paginate($hits); return view('legacy::received-comments', [ 'comments' => $comments, 'currentPage' => $currentPage, 'hits' => $hits, 'total' => $comments->total(), ]); } }