Laravel or where


DB::table(‘table_name’)->where(‘column_name’, ‘condition’, value)->orWhere(‘column_name’,’condition’,value)->get(); is used for orWhere condition in laravel.


Laravel or where clause Example

We are going to fetch data with where clause in laravel from the table emp.

DB::table('emp')->where('salary', '=',10000)->orWhere('experience' = '1')->get();

Will Generate the following query.

//Select * from emp where salary = ‘10000’ or experience = ‘1’ ;


Advertisements

Add Comment

📖 Read More