Laravel orWhere Condition Example

Admin   Laravel   163  2021-03-16 20:20:10

Hi Guys,

In this example,I will learn you how to use orWhere condition in laravel.you can simply use the orwhere condition in laravel.

orWhere condition is used to fetch the corresponding value of the same by matching the value from the column of the particular table.bellow Example

Example 1: orWhere Query Builder

 

/**

* The attributes that are mass assignable.

*

* @var array

*/

public function index()

{

$users = DB::table('users')

->where('votes', '=', 150)

->orWhere('name', '=', 'mehul')

->get();

dd($users);

}

Example 2: > Greater Then For Price

 

/**

* The attributes that are mass assignable.

*

* @var array

*/

public function index()

{

$users = DB::table('users')

->where('votes', '>', 150)

->orWhere('name', '=', 'mehul')

->get();

dd($users);

}

Example 3: < Less Then For Price

 

/**

* The attributes that are mass assignable.

*

* @var array

*/

public function index()

{

$users = DB::table('users')

->where('votes', '