You are stuck in finding those values which are null or not null in laravel and don’t know how to check where null or where not null conditions using laravel eloquent model. Laravel provides built-in eloquent functions that perform the same duty for us.

Solution – Laravel is NULL?

To find the is null value in model eloquent query you have to put the where clause like Model::where(“column name”, null) like below

It will return all records which has null username.

Solution – Laravel is Not NULL?

To find those records which have no null records in laravel by checking a specific columns you can use the WhereNotNull() function.

It will return all those records which has no null values.

This will do the same because in SQL we use <> signs for NOT, by running the above query will return all those records which no null value.


Subscribe To Our Newsletter

Subscribe To Our Newsletter

Join our mailing list to receive the latest news and updates from our team.

You have Successfully Subscribed!