In this artical we will see how to use where and orwhere condition in laravel 8. For where() and orWhere() method the first argument is the name of the column. The second argument is an operator, which can be any of the database's supported operators. The third argument is the value to compare against the column's value.
$users = DB::table('users')
->where('id', '=', 5)
->where('department', '=', 'Designer')
->where('age', '>', 25)
->get();
Now, we will see orWhere() condition in laravel 8 and how to write orWhere() condition in laravel. so first we will see SQL query for better understanding.
SELECT * FROM users WHERE id='5' OR salary='10000';
$users = DB::table('users')
->where('salary', '>', 10000)
->orWhere('name', 'Mark')
->get();
You might also like :