Wednesday, March 29, 2017

WhereIn in eloquent orm

I have two arrays

temp[]
time[]

now for example if i have data in my array something like this

    temp   time 
[0]  80     45
[1]  70     50
[2]  85     65
[3]  90     30 

i want to query data in terms of these two array params like (select * from MyTable where (temperature = 80 and time = 45 ))for the next (select * from MyTable where (temperature = 70 and time = 50 )) and so on

I am doing something like this

 $mix=MyTable::whereIN('temperature', $temp)
         ->whereIN('time', $time)->where('category',$cat)
         ->get();

But the output it is qiving me is kind of a combination of these two params.not exactly from array 0 to onwards...

I hope i explained my question..



via Hassan Haroon

Advertisement