$array1=['A1','A2','A3','A4'];
$test=salle::select('code_salle','type_salle')->where('code_salle',$array1)->get();
return $test;
return
[{"code_salle":"A1","type_salle":"AMPHI"}]
Maybe I'm wrong in the syntax
CodePudding user response:
You want to try whereIn
instead:
https://laravel.com/docs/9.x/queries#additional-where-clauses
$array1=['A1','A2','A3','A4'];
$test=salle::select('code_salle','type_salle')->whereIn('code_salle',$array1)->get();
return $test;