简体   繁体   English

未找到基表或视图:1146 表 'doctor1.education' 不存在(SQL: select * 来自 `education` where `education`.`dr_id` in (1))

[英]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 where education . dr_id in (1)) SQLSTATE [42S02]:未找到基表或视图:1146 表 'doctor1.education' 不存在(SQL:select * from education where education . 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.

相关问题 未找到基表或视图:1146 表 'xyz.testimonials' 不存在(SQL:select * from `testimonials`) - Base table or view not found: 1146 Table 'xyz.testimonials' doesn't exist (SQL: select * from `testimonials`) LARAVEL - 未找到基表或视图:1146 表不存在(SQL: select * from ) - LARAVEL - Base table or view not found: 1146 Table doesn't exist (SQL: select * from ) SQLSTATE [42S02]:找不到基本表或视图:1146表'app.articles'不存在(SQL:从* articles中选择*) - SQLSTATE[42S02]: Base table or view not found: 1146 Table 'app.articles' doesn't exist (SQL: select * from `articles`) SQLSTATE [42S02]:未找到基表或视图:1146 表“iop.servicecategories”不存在(SQL:select * 来自“servicecategories”) - SQLSTATE[42S02]: Base table or view not found: 1146 Table 'iop.servicecategories' doesn't exist (SQL: select * from `servicecategories`) SQLSTATE [42S02]:未找到基表或视图:1146 表“fresh_start.event”不存在(SQL:select 计数(*)作为来自“事件”的聚合) - SQLSTATE[42S02]: Base table or view not found: 1146 Table 'fresh_start.event' doesn't exist (SQL: select count(*) as aggregate from `event`) SQLSTATE[42S02]:未找到基表或视图:1146 表“database_name.contacts”不存在(SQL:select * 来自“contacts”限制 1) - SQLSTATE[42S02]: Base table or view not found: 1146 Table 'database_name.contacts' doesn't exist (SQL: select * from `contacts` limit 1) SQLSTATE[42S02]:未找到基表或视图:1146 表 '***.indices' 不存在 laravel - SQLSTATE[42S02]: Base table or view not found: 1146 Table '***.indices' doesn't exist laravel 未找到基表或视图:1146 表 'admin.model' 不存在 - Base table or view not found: 1146 Table 'admin.model' doesn't exist 找不到基表或视图:1146表'epharmacy.medicines'不存在 - Base table or view not found: 1146 Table 'epharmacy.medicines' doesn't exist SQLSTATE [42S02]:未找到基表或视图:1146表X不存在 - SQLSTATE[42S02]: Base table or view not found: 1146 Table X doesn't exist
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM