In this tutorial you will learn about the Laravel whereNotBetween Query Example and its application with practical example.
In this laravel where not between eloquent query example tutorial, I’ll show you how to fetch data from database table skipping data in the provided between range using laravel whereNotBetween eloquent query.
Laravel whereNotBetween eloquent query
The laravel whereNotBetween eloquent queryis used to fetch data from database table skipping data in the provided between range. Suppose, you want to fetch some data from database in laravel and you may want to skip some records between two column values. This can be achieved using laravel eloquent whereNotBetween cluase.
Laravel whereNotBetween query With Ids
1 |
$users = User::whereNotBetween('id', [1, 50])->get(); |
The above laravel eloquent query fetches all records from the users table skipping records between id 1 to 50 from users table.
Laravel Eloquent whereNotBetween Dates
1 |
$users = User::->whereNotBetween('created_at', [start_date, end_date])->get(); |
The above laravel eloquent query get all records from database table. But it skips records between given start date to end date.