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