Eloquent Wherein Query Laravel

wherein Query use in Laravel, Laravel 6.0, Use wherein Query use in Laravel 5.7, Eloquent wherein Query use in Laravel 5.8,wherein Query use in Laravel 5.6,wherein Query use in Laravel 5.5,wherein Query use in Laravel 5.4,wherein Query use in Laravel 5.3,wherein Query use in Laravel 5.2

Today I will tell you through this tutorial that why wherein query is used in the laravel framework.

Let me tell you that these are part of the query builder. We also know this by the name of eloquent query builder. Wherein the query is used and how I use it, I will try to understand it by example.

Suppose your table has 5 data. And you want to get the starting value of 1, 2, or 3 row from the start. So for that you can get data using wherein query.

“The whereIn method verifies that a given column’s value is contained within the given array.”

Eloquent Wherein Query use by Query Builder in Laravel

$products = DB::table('products')
->whereIn('id', [1, 2, 3])

Eloquent Wherein Query use by Model in Laravel

$products = Products::whereIn('id', [1, 2, 3])->get();