Relationship method must return an object of type
請大神支招: 問題:在laravel 5.2.45下使用本視頻中_form.blade.php頁面性別處理 {{ isset($student->sex) && $student->sex == $ind ? 'checked' : '' ?}},會報LogicException in Model.php line 2723: Relationship method must return an object of type Illuminate\Database\Eloquent\Relations\Relation錯誤。 菜鳥一枚,請多指教。不勝感謝!(視頻laravel版本5.2.22)
2018-02-05
2018-02-07
使用我上面的語句,增加頁面顯示正常了,但在修改頁面卻無法selected。還是得改方法名
2018-02-07
謝謝,的確解決問題了。不過,我用以下語句也成功了
{{ isset($this->$student->sex) && $this->$student->sex == $level ? 'selected' : ''? }}