2-7使用了isset之后create頁面仍報錯
ErrorException?in?Model.php line 2697:Relationship method must return an object of type Illuminate\Database\Eloquent\Relations\Relation (View: /home/ubuntu/workspace/resources/views/student/_form.blade.php) (View: /home/ubuntu/workspace/resources/views/student/_form.blade.php)
?????????????????????????????????????????@foreach($student->sex() as $ind=>$val)
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? <label class="radio-inline">
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? <input type="radio" name="Student[sex]"?
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? {{ isset($student->sex) && $student->sex == $ind ? 'checked' : '' }}?
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? value="{{ $ind }}">{{ $val }}
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? </label>
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? @endforeach
修改頁面可以使用,但是create加了isset之后仍然報錯
2016-12-13
將sex()改成別的方法比如sexList()
2016-12-13
這個可以通過在model中添加一個默認的屬性
2016-12-06
我用了isset就沒有報錯了