how to change SQL Query
SELECT * FROM aps WHERE kategori IS NULL
to Laravel Eloquent/Query Builder?
函数whereNull
,因此您可以执行以下操作:
\DB::table('aps')->whereNull('kategori')->get();
If Ap
is a model, then
$data = Ap::whereNull('kategori')->get();
If aps
is table name, then
$data = DB::table('aps')->whereNull('kategori')->get();
$apps = DB::table('aps')
->whereNull('kategori');
上面的查询可以写成
DB::table('aps')->whereNull('kategori')->get();
You can use the whereNull
function
$data=DB::table('aps')->whereNull('kategori')->get();
Refer this documentation for further reference https://laravel.com/docs/5.6/queries
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.