Laravel 4 - Can't retrieve data in a one-to-many relationship

前端 未结 5 1351
故里飘歌
故里飘歌 2021-01-21 18:45

I have a Quote model:

class Quote extends Eloquent {

    public function quote_lines() {
        return $this->hasMany(\'QuoteLine\');
    }    

}
         


        
5条回答
  •  走了就别回头了
    2021-01-21 19:17

    You do not call the function, but you want to grab variable named $quote_lines. Try to call $quote_lines = Quote::find($id)->quote_lines(); instead.

提交回复
热议问题