Where not in Laravel

2024-04-27 14:57:14 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