2

---------- テーブル ----------

ユーザー

  • ユーザーID

顧客

  • 顧客ID
  • ユーザーID

スケジュール

  • スケジュール_id
  • メール ID
  • 顧客ID

メール

  • メール ID
  • 主題

--------- モデル ----------

スケジュール_モデル

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();

顧客を通じてユーザー情報を取得する方法を教えてください。あなたの貢献には本当に感謝をしている!

4

1 に答える 1