我有默认的laravel通知数据字段和默认的通知表 只尝试根据用户的通知数据值为用户选择一些通知,我已经在用户模型中创建了此功能
public function notifications_data($col)
{
$notifications = $this->notifications()->where('data' , function ($q) use ($col){
$q->where('appointment_id','0'); // query data as table
})->get();
return ($notifications);
}
我已在通知表col数据中保存了值{“ type”:“ Appointment”,“ appointment_id”:“ 0”,“ date”:null,“ updated_by”:“”,“ status”:“ 0”}
如何获取状态为0或约会ID = 0的所有通知
答案 0 :(得分:0)
也许可行:
sc %>% spark_session() %>% invoke("catalog") %>% invoke("dropTempView", "iris")
答案 1 :(得分:0)
使用Laravel的查询生成器:
public function notifications_data()
{
$notifications = DB::table('notifications') //Specify the table you want to query
->where('status',0) //Where status = 0
->orWhere('appointment_id',0) //or appointment_id = 0
->get();
return $notifications;
}
答案 2 :(得分:0)
您还可以使用:
public function notifications_data($col)
{
$notifications = $this->notifications()
->where('data->appointment_id', 0)
->orWhere('data->status', 0)
->get();
return ($notifications);
}