Passing value as array in Where clause in Laravel
<p>I have an array in <code>$qids</code> as 
<code>[{"qid":1},{"qid":2},{"qid":3},{"qid":4}]</code>, Now, I want to get rows from database matching these <code>qid</code> value. I am working on my Laravel project and the where clause I am using is as follows</p>

<pre><code>$questions = Question::where(function($q) use ($qids){
    foreach($qids as $key =&gt; $value){
        $q-&gt;where($key, '=', $value);
    }
})-&gt;get();
</code></pre>

<p>This gives me an error </p>

<pre><code>*SQLSTATE[42S22]: Column not found: 1054 Unknown column '0' in 'where clause' (SQL: select * from `questions` where (`0` = {"qid":1} and `1` = {"qid":2} and `2` = {"qid":3} and `3` = {"qid":4}))*
</code></pre>

<p>As I can see, in the error line</p>

<pre><code>where (`0` = {"qid":1} and `1` = {"qid":2} and `2` = {"qid":3} and `3` = {"qid":4})
</code></pre>

<p>it is taking 0, 1, 2, 3 as key and whole {"qid":1} as value.</p>

<p>FYI, I am generating <code>$qids</code> from the statement.</p>

<pre><code>$qids = Examquestion::select('qid')-&gt;where('examid', $examid)-&gt;get();
</code></pre>

<p>is there any way that I could save only values in <code>$qids</code> rather than pair. 
Hope you understand the scenario. TIA.</p>