Laravel Where Null and Where Not Null Query

In this tutorial you will learn about the Laravel Where Null and Where Not Null Query and its application with practical example.

In this Laravel where Null and where Not Null example tutorial I’ll show you how to use whereNull() and whereNotNull() methods in laravel. In this tutorial you will learn to use whereNull() and whereNotNull() methods for creating laravel eloquent queries. In this article I’ll share different use case of the whereNull() and whereNotNull() methods in laravel. In this Laravel where Null and where Not Null tutorial you will learn about the syntax and the use of whereNull and whereNotNull eloquent methods.

Laravel whereNull method syntax

Here is the general syntax of the laravel whereNull method:

Laravel whereNotNull method syntax

Here is the general syntax of the laravel whereNotNull method:

Laravel whereNull Query

In this example query we will fetch data from database table for the  users where the name field empty. In this query we will demonstrate the use of whereNull Query. The laravel whereNull Query can be used as following:

The above given whereNull query you will get the following SQL query:

Laravel whereNotNull Query

In this example query we will fetch data from database table for the  users where the email_verified_at field is not empty in DB table:. In this query we will demonstrate the use of whereNotNull Query. The laravel whereNotNull Query can be used as following:

The above given whereNull query you will get the following SQL query:

In this tutorial we have learn about the Laravel Where Null and Where Not Null Query and its application with practical example. I hope you will like this tutorial.