Laravel WhereNotNull Query Example
Hi Guys,
In this example,I will learn you how to use whereNotNull query in laravel .you can simply use to whereNotNull query in your controller. we are so easy example where not null or not empty in laravel.
i will let you know how you can write query for where not null and where not null condition. here i will write core SQL query and then convert it into laravel query builder using db. So just see bellow example and see how it is works.
Example 1
/**
* Show the application dashboard.
*
* @return \Illuminate\Contracts\Support\Renderable
*/
public function index()
{
$news = \DB::table('availability')
->whereNotNull('availability_time')
->get();
dd($news);
}
Example 2
/**
* Show the application dashboard.
*
* @return \Illuminate\Contracts\Support\Renderable
*/
public function index()
{
$posts = \DB::table('property')
->whereNotNull('smoking')
->get();
dd($posts);
}
Example 3
/**
* Show the application dashboard.
*
* @return \Illuminate\Contracts\Support\Renderable
*/
public function index()
{
$users = User::whereNotNull('updated_at')->get();
dd($users);
}
It will help you...
- How to Notifications With database Driver in Laravel 11?
- How to Send Email Via Notification in Laravel 11?
- How to Install and Configure Laravel 11 Debugbar?
- How to Like Dislike System in Laravel 11?
- How to Paginate a Model with Relationship in Laravel 11?
- Laravel 11 Upload Files to Amazon S3 Example
- Laravel 11 Send WhatsApp Messages Example
- Laravel 11 Rest API Authentication Using JWT Tutorial