Tuesday, February 28, 2017

How to get same result multiple times with same inputs in laravel ORM?

i have different input fields and two of them are name_id[] and aussehen[] in the view.for example if user inputs two same value of (1,1) for the name_id and also (1,1) for the aussehen.when i run this query below.

$aussehen=Stufen::whereIN('name_id', $name_id)
         ->whereIN('stufe',$aussehen)
         ->get();

I get only one array when dd($aussehen). whereas i wanted to have two same arrays because user inputs the same values two times. But if user select two different values e.g (1,2) for name_id and (3,4) for aussehen then it shows the correct result with two arrays what i am expecting. Now is there anyway to get the same result even if user inputs the same values as much time as he wants?




via Hassan Haroon

Advertisement