title: Customising Laravel 5.5 Api Resource Collection pagination
body: <p>I have been working with laravel api resource. By default laravel provides links and meta as shown below.</p>
  
  <pre><code>"links": {
      "first": "https://demo.test/api/v2/taxes?page=1",
      "last": "https://demo.test/api/v2/taxes?page=4",
      "prev": null,
      "next": "https://demo.test/api/v2/taxes?page=2"
  },
  "meta": {
     "current_page": 1,
     "from": 1,
     "last_page": 4,
     "path": "https://demo.test/api/v2/taxes",
     "per_page": 2,
     "to": 2,
     "total": 8
  } 
  </code></pre>
  
  <p>But I don't want this, insted i want something like</p>
  
  <pre><code>"pagination": {
    "total": 8,
    "count": 8,
    "per_page": 25,
    "current_page": 1,
    "total_pages": 1
  }
  </code></pre>
  
  <p>I'm able to get this info but if I do <code>return TaxResource::collection($taxes);</code>, I won't get this. Even I have custom collection method </p>
  
  <pre><code> public static function collection($resource)
      {
         $resource-&gt;pagination = [
          'total' =&gt; $resource-&gt;total(),
          'count' =&gt; $resource-&gt;count(),
          'per_page' =&gt; $resource-&gt;perPage(),
          'current_page' =&gt; $resource-&gt;currentPage(),
          'total_pages' =&gt; $resource-&gt;lastPage()
         ];
          return parent::collection($resource);
      }
  </code></pre>
  
  <p>It is not giving what I want. But if I reference through <code>(TaxResource::collection($taxes))-&gt;pagination;</code> I'm able to get that. But I want it to be returned when I do <code>return TaxResource::collection($taxes);</code></p>