Home / Snippets / Laravel Where Not Null and Where Null
Laravel Where Not Null and Where Null cover

Laravel Where Not Null and Where Null

402

2 years ago

0 comments

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();
notion avatar

Ahmad Aziz

Week-end developer currently experimenting with web, mobile, and all things programming.

Topics:

Frontend

Resource

Average

Average

Support Us

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

Post Tutorials

Learn trending tutorials for ReactJs, React Native, VueJS, NextJs, Laravel, Tailwind CSS, and Flutter development.
View Tutorials

Code Components

Collection of Tailwind CSS components for everyone to use. Browse all of the components that's right for your web projects
View Components

Welcome to PostSrc V3

PostSrc Dark Logo

You have to login to favorite this