SQLSTATE42S02:基本表或视图未找到: 1146表'doctor1.education‘不存在(SQL: select * from
educationwhereeducation.dr_idin (1))
这里我想在表教育中使用hasMany作为外键,这里的医生id是外键
医生模式代码表:-
public function educations(){
return $this->hasMany('App\Models\Education','dr_id');
}教育模式表:-
public function doctor(){
return $this->belongsTo('App\Models\Doctor','dr_id');
}此页面的控制器代码:-
public function profilesetting(){
$userinfo = Doctor::with('educations')->where('id','=',session('drid'))->get();
dd($userinfo);
}请告诉我我是如何解决这个错误的?
发布于 2022-06-08 12:12:03
数据库模型中的找不到表教育--我认为在教育模型中使用这一行
protected $table = "educations";https://stackoverflow.com/questions/72545264
复制相似问题