Laravel orWhere Condition Example

Share Me
  •  
  •  
  •  
  • 1
  •  
  •  
  •  
  •  
  •  
  •  
  •  
    1
    Share

Today now in this example,I will show you how to use orWhere condition in laravel application . Here we can simply use the orwhere condition in laravel application.

we can use orWhere condition to fetch the corresponding value of the same by matching the value from the column of the particular table. Just follow 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);
}

Read Also : Laravel 8 Eloquent Global Scope Tutorial Example

I hope it will help you. Also you can follow us on Facebook

About Shahriar Sagor

My name is Shahriar sagor. I'm a developer. I live in Bangladesh and I love to write tutorials and tips that will help to other Developer's. I am a big fan of PHP, Javascript, JQuery, Laravel, Codeigniter, VueJS, AngularJS and Bootstrap from the early stage.

View all posts by Shahriar Sagor →