Laravel orWhere Condition Example

Laravel 6 , Laravel , Laravel 7

Nicesnippets

150

10-01-2020


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....


Recommended Posts