'JSON object to eloquent object?

With this function:

public function getArticleQuantity(Article $article){
    return $this->articles->where('id', $article->id);
}

I get back this JSON array with just one object:

[
   {
      "id":630,
      "name":"Dario Lueilwitz",
      "pivot":{
         "article_quantity":3
      }
   }
]

So i can't get the data in pivot->article_quantity, should i use another method or may i convert this JSON response in an eloquent object?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source