Laravel collection contains
<p>I'm using the Laravel <code>contains</code> method on a collection <a href="https://laravel.com/docs/5.3/collections#method-contains" rel="noreferrer">https://laravel.com/docs/5.3/collections#method-contains</a>. But it does not work for me. </p>

<pre><code>foreach ($this-&gt;options as $option) {
    if($options-&gt;contains($option-&gt;id)) {
        dd('test');
    }
}
</code></pre>

<p><code>dd($options);</code> looks like this:</p>

<pre><code>Collection {#390
  #items: array:1 [
    0 =&gt; array:3 [
      0 =&gt; array:7 [
        "id" =&gt; 10
        "slug" =&gt; "test"
        "name" =&gt; "test"
        "poll_id" =&gt; 4
        "created_at" =&gt; "2016-11-12 20:42:42"
        "updated_at" =&gt; "2016-11-12 20:42:42"
        "votes" =&gt; []
      ]
      1 =&gt; array:7 [
        "id" =&gt; 11
        "slug" =&gt; "test-1"
        "name" =&gt; "test"
        "poll_id" =&gt; 4
        "created_at" =&gt; "2016-11-12 20:42:42"
        "updated_at" =&gt; "2016-11-12 20:42:42"
        "votes" =&gt; []
      ]
      2 =&gt; array:7 [
        "id" =&gt; 12
        "slug" =&gt; "test-2"
        "name" =&gt; "test"
        "poll_id" =&gt; 4
        "created_at" =&gt; "2016-11-12 20:42:42"
        "updated_at" =&gt; "2016-11-12 20:42:42"
        "votes" =&gt; []
      ]
    ]
  ]
}
</code></pre>

<p>Result of <code>dd($option-&gt;id);</code> is <code>10</code>.</p>

<p>What could be wrong? Or is there a better way?</p>