Laravel Eloquent where the field is null or Not null

/ By Arjun / Published on February 16, 2021

In this post, we gonna look at using Laravel’s Eloquent ORM and Query Builder methods to query data from the database where the field is null and where the field is not the null scenario.

Check if null: whereNull

Let’s assume you have a task table and you want to get all the task list where there are no views.

SQL:
Laravel Eloquent
Laravel Query Builder

Check if not null: whereNotNull

Let’s assume you have a task table and you want to get all the task lists where there are views.

SQL:
Laravel Eloquent
Laravel Query Builder

I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x