Where not in Laravel

2024-04-20 22:21:06 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