query('page', 1)); $hits = 20; $query = Artwork::where('user_id', $user->id) ->approved() ->published() ->public() ->orderByDesc('published_at'); $total = (int) $query->count(); $artworks = $query->skip(($page - 1) * $hits)->take($hits)->get(); return view('legacy.gallery', [ 'user' => $user, 'artworks' => $artworks, 'page' => $page, 'hits' => $hits, 'total' => $total, ]); } }