定義された販売モデルがあり、それを呼び出すQuote::find('1');
と販売オブジェクトが返されません。私は私の関係に何か悪いことをしましたか? テーブル構造は次のとおりです。
引用:id、companyName、stage、saleId
セール: ID、名前、電話番号
Class Quote extends Eloquent
{
protected $with = ['sale'];
public function sale()
{
return $this->hasOne('Sale', 'id');
}
}
私のSale
モデルでは、次のように定義しました。
public function quote()
{
return $this->belongsTo('Quote');
}