Today I will tell you through this tutorial that why whereNotIn 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. whereNotIn the query is used and how I use it, I will try to understand it by example.
Keywords :- whereNotIn Query use in Laravel, Laravel 6.0, Use whereNotIn Query use in Laravel 5.7, Eloquent whereNotIn Query use in Laravel 5.8,whereNotIn Query use in Laravel 5.6, Laravel 5.5, Laravel 5.4, Laravel 5.3, Laravel 5.2
Suppose your table has 5 data. And you want to do not get the starting value of 1, 2, or 3 row from the start. So for that you can get data using whereNotIn query.
“The whereNotIn method verifies that the given column’s value is not contained in the given array.”
Eloquent whereNotIn Query use by Query Builder in Laravel
$products = DB::table('products') ->whereNotIn('id', [1, 2, 3]) ->get();
Eloquent whereNotIn Query use by Model in Laravel
$products = Products::whereNotIn('id', [1, 2, 3])->get();