title: paginate manually after paginate
body: <p>I want to sort pictures by like and paginate them .</p>
  
  <p>Like has a table with : <code>pic_id ,user_id</code></p>
  
  <p><code>pic_id</code> is the id of the picture 
  and user_id is the id of the user who liked the picture.</p>
  
  <p>in $sort we have  <code>pic_id</code> and <code>count</code> which is count of likes.</p>
  
  <p>Now, the problem are pictures with 0 likes, which are not adding in $pic</p>
  
  <p>any solution?</p>
  
  <pre><code>public function sort()
  {
      $id = Auth::user()-&gt;id;
      $sort=DB::table('likes')
           -&gt;select('pic_id',DB::raw('count(pic_id) as count'))
           -&gt;groupBy('pic_id')
           -&gt;orderBy('count','desc')
           -&gt;paginate(3);
  
      $pic_id=collect($sort-&gt;items())-&gt;pluck('pic_id')-&gt;toArray();
      $pic=Picture::whereIn('id',$pic_id)
                   -&gt;with('user')
                  -&gt;get();
  
      $data=new LengthAwarePaginator($pic,$sort-&gt;total(),$sort-&gt;perPage(),$sort-&gt;currentPage());
      return response()-&gt;json([
          'success' =&gt; true,
          'data' =&gt; $data,
      ]);
  }
  </code></pre>