亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

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之后仍然報錯

正在回答

3 回答

將sex()改成別的方法比如sexList()

1 回復 有任何疑惑可以回復我~
#1

慕桂英9392754

為什么這樣就會好呀
2017-08-06 回復 有任何疑惑可以回復我~

這個可以通過在model中添加一個默認的屬性

public?$sex?=?0;


0 回復 有任何疑惑可以回復我~

我用了isset就沒有報錯了

<input?type="radio"?{{isset($student->sex)?&&?$student->sex==$item?'checked="checked"':''}}?name="student[sex]"?value="{{$item}}">?{{$value}}


0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

2-7使用了isset之后create頁面仍報錯

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號