Laravel whereNull() and whereNotNull() function example; Through this tutorial, i am going to show you how to use whereNull() and whereNotNull() function with eloquent queries in laravel apps.
Example 1 – Laravel WhereNull()
Now, i am going to show you how to use whereNull() function with db::table() in laravel app; as follows:
$users = DB::table('users')
->whereNull('updated_at')
->get();
Note that:- The whereNull method verifies that the value of the given column is NULL.
Example 2 – Laravel whereNotNull()
Now, i am going to show you how to use whereNotNull() function with db::table() in laravel app; as follows:
$users = DB::table('users')
->whereNotNull('updated_at')
->get();
Note that :- The whereNotNull method verifies that the column’s value is not NULL.