eloquent - Laravel 5.4 whereNotIn apparently not working -


i have logic in controller builds array called $exclude.

using dd $exclude :

array:4 [▼   0 => 2   1 => 3   2 => 4   3 => 5 ] 

which correct.

i want exclude result have:

$potype = db::table('potypes')                 ->wherenotin('id',[$exclude])                 ->get(); 

but when run query items included exception of first in array. enabled query log with

db::enablequerylog(); 

and ran

dd(db::getquerylog()); 

with result of

array:1 [▼   0 => array:3 [▼     "query" => "select * `potypes` `id` not in (?)"     "bindings" => array:4 [▼       0 => 2       1 => 3       2 => 4       3 => 5     ]     "time" => 0.67   ] ] 

the table has 8 records running query returning 7, ommiting first of list:

collection {#621 ▼   #items: array:7 [▼ 

if use implode

$ex = implode(',',$exclude) , change query ->wherenotin('id',[$ex]) same result - 7 items first in list being ignored.

is eloquent bug or me?

delete [ ] , check again:

$potype = db::table('potypes')                 ->wherenotin('id',$exclude)                 ->get(); 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -