【发布时间】:2020-06-03 21:43:42
【问题描述】:
--------- 表格 ----------
用户
- user_id
客户
- customer_id
- user_id
时间表
- schedule_id
- mail_id
- customer_id
邮件
- mail_id
- 主题
------型号----------
schedules_model
public function customer()
{
return $this->belongsTo('App\Customer', 'customer_id');
}
public function mail()
{
return $this->belongsTo('App\Mail', 'mail_id');
}
public function user()
{
return $this->hasOneThrough(?);
}
------ 控制器 ----------
$schedules = schedules_model->with('customer')->with('mail')->get();
请帮助我如何通过客户获取用户信息? 非常感谢您的支持!
【问题讨论】: