title: How to use pagination in laravel api?
body: <p>My problem: I need to use pagination in the simple api that I am trying to develop using laravel. I was using <a href="http://fractal.thephpleague.com/pagination/" rel="noreferrer">Cursors</a> to do it. But results are blank even if my model is returning result.</p>
  
  <p>My code:</p>
  
  <pre><code>$newCursor = $groups-&gt;last()-&gt;id;
  $cursor = new Cursor($cursor, $previousCursor, $newCursor, $groups-&gt;count());
  
  //dd($cursor);
  
  $groups =  new Collection(fractal($groups, new GroupRequestTransformer('filtered')));
  $groups-&gt;setCursor($cursor);
  
  $data = [
      'groups' =&gt; $groups,
      'cursor' =&gt; $cursor
   ];
  
  $this-&gt;setResponseStatus(true, 200, trans('group.filtered'));
  return $this-&gt;sendResponseData($data);
  </code></pre>
  
  <p>Note: <code>$groups</code> has values returned from model. And if I <code>dd($cursor);</code>, I get </p>
  
  <pre><code>Cursor {#403
    #current: "5"
    #prev: null
    #next: 13
    #count: 1
  }
  </code></pre>
  
  <p>so this seems fine to. But the the actual response that I am sending as <code>$data</code> is blank.</p>
  
  <pre><code>"data": {
      "groups": {},
      "cursor": {}
    }
  </code></pre>
  
  <p>What am I missing here?</p>