In this article, we will see laravel where and orWhere condition example. we will give you a very simple example of the laravel where() and orWhere() condition and also we will give you an example of where() and orWhere in a single query in laravel 6/7/8. You can use the where and orwhere method in laravel 6, laravel 7, and laravel 8.
For the where() and orWhere() methods 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.
So, let's see laravel 7/8 where query and laravel 7/8 orwhere query.
$users = DB::table('users')
->where('id', '=', 10)
->where('department', '=', 'web development')
->where('age', '>', 35)
->get();
Now I will show you an example of orWhere() query in laravel 6/7/8 and how to write orWhere() condition in laravel. So first we will see SQL query for better understanding.
SELECT * FROM users WHERE id='10' OR salary='20000';
Example of orWhere() condition in laravel 6/7/8
$users = DB::table('users')
->where('salary', '>', 20000)
->orWhere('name', 'Maria')
->get();
Today we will learn how to remove elements from javascript array, you can use diffrents javascript array...
Apr-07-2021
Welcome to the fourth installment of our "Laravel Tips: DB Models and Eloquent" series. In this article, we co...
Oct-18-2023
In this article, we will see the laravel 9 livewire datatable example. Here, we will learn how to use livewire data...
Nov-30-2022
In this article, we will see how to create a dynamic bar chart in laravel 9. Bar charts are used to represent...
Mar-21-2022