Where Condition Use in Laravel

Hello Friends Today, through this tutorial, I will tell you why we use the Where Statement Condition in the laravel framework. So let’s go

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

Keywords :- Eloquent Where Condition Use in Laravel 6.0, Where Condition Use in Laravel 5.8, Where Condition Use in Laravel 5.7, Where Condition Use in Laravel 5.6, Where Condition Use in Laravel 5.5, Where Condition Use in Laravel 5.4, Where Condition Use in Laravel 5.3, Where Condition Use in Laravel 5.2

For example, as if you have a table named users and it has a column of fname. Now you want that you get only the value of jyoti name from the table of that fname column, then we will use the query where statement, how will this query be used. Let’s see below as an example

Use Where Query Statement in Laravel Query Builder

$users = DB::table('users')
->where('fname', '=', 'jyoti')
->get();

Use Where Query Statement in Laravel For Model

$users = User::where('fname', '=', 'jyoti')->get();

 

> Greater Then Where Statement Condition For Price

$users = DB::table('users')
->where('price', '>', 100)
->get();

<  Less Then Where Statement Condition For Price

$users = DB::table('users')
->where('price', '<', 100)
->get();