Where not in Laravel

2019-12-07 19:26:44 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