title: Laravel collection structure change
body: <p>I have two APIs for users.</p>
  <ol>
  <li>returns a single record.</li>
  <li>returns collection of users.</li>
  </ol>
  <p>1st API output structure should be</p>
  <pre class="lang-json prettyprint-override"><code>{
      &quot;message&quot;: &quot;Employee record&quot;,
      &quot;data&quot;: {
          &quot;first_name&quot;: &quot;..and so on&quot;,
      }
  }
  </code></pre>
  <p>2nd API output structure should be</p>
  <pre class="lang-json prettyprint-override"><code>{
      &quot;message&quot;: &quot;Employee record&quot;,
      &quot;data&quot;: [
          {
              &quot;first_name&quot;: &quot;..and so on&quot;,
          },
          {
              &quot;first_name&quot;: &quot;..and so on&quot;,
          },
      ]
  }
  </code></pre>
  <p>Can I do this with only UserResource? Or should I create another resource for the collection?</p>