[英]Base table or view not found: 1146 Table 'doctor1.education' doesn't exist (SQL: select * from `education` where `education`.`dr_id` in (1))
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'doctor1.education' doesn't exist (SQL: select * from
education
whereeducation
.dr_id
in (1))SQLSTATE [42S02]:未找到基表或视图:1146 表 'doctor1.education' 不存在(SQL:select * from
education
whereeducation
.dr_id
in (1))
here i want to use hasMany for my foreign key in table educations,here doctor id is foreign key在这里我想在表教育中使用 hasMany 作为我的外键,这里医生 id 是外键
Doctor Model Code for doctors table:-医生 Model 医生表代码:-
public function educations(){
return $this->hasMany('App\Models\Education','dr_id');
}
Education model for educations table:-教育表的教育 model:-
public function doctor(){
return $this->belongsTo('App\Models\Doctor','dr_id');
}
Controller Code for this page:- Controller 此页面的代码:-
public function profilesetting(){
$userinfo = Doctor::with('educations')->where('id','=',session('drid'))->get();
dd($userinfo);
}
please tell me that how i solve this error?请告诉我如何解决这个错误?
in database model cant find table educations i think use this line in Education model在数据库 model 中找不到表教育我认为在教育 model 中使用此行
protected $table = "educations";
Thank you for the advice,it will help me谢谢你的建议,它会帮助我
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.