Where in eloquent orms
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 parameters (select * from MyTable where (temperature = 80 and time = 45)) for next (select * from MyTable where (temperature = 70 and time = 50)), etc. ...
I am doing something like this
$mix=MyTable::whereIN('temperature', $temp)
->whereIN('time', $time)->where('category',$cat)
->get();
But the output it produces is a combination of the two. Not from array 0 to and on ...
Hope I explained my question correctly.
I tried this.
$result=Ergebnisse::where('name_id', $nam)->where('geometrie_id', $geo)->get();
foreach ($result as $key => $res) {
$mix=Ergebnisse::where('temperatur', $res->temperatur)
->where('zeit', $res->zeit)->groupBy('katogorie_id')
->get();
}
when i dd ($ mix) only shows one result. but according to my db it should show more than one
+3
source to share
1 answer