I was working on my laravel 5.6 application on this Sunday and I require to use a not null query with where condition in laravel eloquent. I mean I need to get all data that not null from the users table. So basically I know how to check not null in MySQL query but I didn't know how to retrieve data using laravel query builder. But I read laravel docs and got it we can do it using "whereNotNull()" of query builder function.
So here I am going to give you a very small example of whereNotNull() function. this task is very small and basic but if you use this one in your laravel app then it makes sense. So in whereNotNull() function we need to pass column name then laravel query builder will manage it how to get data from that column.
So let's see bellow example with syntax:
$users = User::select("*")
I hope you found your best solution....
Do you like below Tutorials ?
- Angular 9 HttpClient Request with RxJS Observable Example
- How to Create Routing Module in Angular 9?
- How to Create Custom Directive in Angular 9?
- Print Iframe Content using JQuery Example
- Allow Only Numeric Values in Textbox using JQuery
- Codeigniter Confirmation Box Before Delete Item Example
- How to Use Sweet Alert in Codeigniter?