Laravel where in
DB::table(‘table_name’)->whereIn(‘column_name’,[value1,value2,value3….])->get(); is used for where In condition in laravel.
Laravel where In clause Example
We are going to fetch data with whereIn clause in laravel from the table emp.
DB::table('emp')->whereIn('salary',[10000,20000,30000])->get();
Will Generate the following query.
//Select * from emp where salary IN (10000, 20000, 30000) ;
Advertisements