Where not in Laravel

2021-01-17 05:42:25 Deepika Laravel

How to use where not in clause in Laravel?

WhereNotIn method of laravel db builder and Eloquent is used to select records that are not in given array.

Where not in Example

whereNotIn Query Builder Example:

DB::table('yourtable')->select(..)->whereNotIn('id', [100,200])->get();

whereNotIn Eloquent Example:

YourModel::select(..)->whereNotIn('id', [100,200])->get();

This post is submitted by one of our members. You may submit a new post here.

Related Tricks