Posts Learn Components Snippets Categories Tags Tools new About
/

Laravel Where Not Null and Where Null

How to check for table columns that have a condition where the value is not null

Created on Jul 26, 2021

154 views

Sometimes you need to check for table columns that have a condition where the value is not null and to do that you can make use of the "whereNotNull" clause.

whereNotNull Example
Below is how you can query the model with "whereNotNull" clause.
Article::query()->whereNotNull('authored_at')->get();

whereNull Example
To get the inverse value which is the column that has a null value then you can use "whereNull" clause.
Article::query()->whereNull('authored_at')->get();

If you like our tutorial, do make sure to support us by being our Patreon or buy us some coffee ☕️

Load comments for Laravel Where Not Null and Where Null

)