How to use where null and where not null eloquent query in laravel?



How to use where null and where not null eloquent query in laravel?..

Answer / Kumud Bharti

"In Laravel Eloquent, you can use 'whereNull()' and 'whereNotNull()' methods to filter records based on whether a column is null or not. Here's an example:

```php
$recordsWithNullColumn = Model::whereNull('column_name')->get();
$recordsWithNotNullColumn = Model::whereNotNull('column_name')->get();
```
"n

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Laravel PHP Framework Interview Questions

Where will you define laravel's facades?

1 Answers  


What is gate in laravel?

1 Answers  


How can you make real time sitemap.xml file in laravel?

1 Answers  


What is antiforgerytoken mvc5?

1 Answers  


What is make method?

1 Answers  


How to pass custom table name in model?

1 Answers  


List some use valet commands?

1 Answers  


Tell me how to enable maintenance mode in laravel 5?

1 Answers  


How do I seed my database for column that is a foreign key referencing to other table?

1 Answers  


What is meant by Laravel - Validation ?

2 Answers  


How to enable maintenance mode in laravel 5?

1 Answers  


What do you mean by horizon in laravel 5?

1 Answers  


Categories