[英]Call to a member function addEagerConstraints() on null getting this error on laravel 6
I am using laravel 6.0 and I am getting this strange error "Call to a member function addEagerConstraints() on null" what I have is notification table where I am having notification_id and this notification_id is linked to notification_message table, I am trying to create a realtion between them I tried everything but I am getting this strange error.我正在使用 laravel 6.0 并且我收到这个奇怪的错误“调用成员函数 addEagerConstraints() on null”我拥有的是通知表,其中我有 notification_id 并且这个 notification_id 链接到 notification_message 表,我正在尝试创建一个他们之间的关系我尝试了一切,但我收到了这个奇怪的错误。
Here is my notification Model where i have defined this relationship这是我的通知模型,我在其中定义了这种关系
public function notificationMessage(){
$this->hasOne('App\Models\NotificationMessage','id');
}
Don't forget to return
the relationship别忘了
return
关系
public function notificationMessage(){
return $this->hasOne('App\Models\NotificationMessage','id');
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.