Laravel orWhere Condition Example

10-Apr-2023

.

Admin

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', '<', 150)

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

->get();

dd($users);

}

It will help you....

#Laravel 7

#Laravel

#Laravel 6