title: laravel array_map get error "array_map(): Argument #2 should be an array"
body: <p>I'm new on laravel. Why I'm always get error:</p>
  
  <blockquote>
    <p>array_map(): Argument #2 should be an array ?</p>
  </blockquote>
  
  <p>whereas I'm assigning parameter array on this method?</p>
  
  <p>this is my example code :</p>
  
  <pre class="lang-php prettyprint-override"><code>$products = Category::find(1)-&gt;products;
  </code></pre>
  
  <p>note :
  1 category has many products</p>
  
  <p>this is the array from query :</p>
  
  <pre><code>[{
     "id": "1",
     "name": "action figure",
     "created_at": "2015-11-09 05:51:25",
     "updated_at": "2015-11-09 05:51:25"
      }, {
      "id": "2",
      "name": "manga",
      "created_at": "2015-11-09 05:51:25",
      "updated_at": "2015-11-09 05:51:25"
  }]
  </code></pre>
  
  <p>when I'm trying the following code:</p>
  
  <pre class="lang-php prettyprint-override"><code>$results = array_map( function($prod) {
      return $prod.name;
  }, $products);
  </code></pre>
  
  <p>and I get the error like below:</p>
  
  <blockquote>
    <p>"array_map(): Argument #2 should be an array"</p>
  </blockquote>