Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change SQL query IS NULL to Laravel Query Builder/Eloquent

Tags:

php

laravel

how to change SQL Query

SELECT * FROM aps WHERE kategori IS NULL

to Laravel Eloquent/Query Builder?

like image 317
Muhammad Anwari Avatar asked Dec 20 '25 13:12

Muhammad Anwari


2 Answers

 $apps = DB::table('aps')
                ->whereNull('kategori');
like image 82
Aram Grigoryan Avatar answered Dec 22 '25 03:12

Aram Grigoryan


The above query can be written as

DB::table('aps')->whereNull('kategori')->get();
like image 44
Faizan Fayaz Avatar answered Dec 22 '25 04:12

Faizan Fayaz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!