Contorller @ edit
public function edit(Choice $choice){
$choice = Choice::find($choice->id);
return view('choices.edit',compact('choice'));
}
查看
{!! Form::model($choice, ['method' => 'PATCH','route' => ['choices.update', $choice->id]]) !!}
<input class="form-control" step="1" min="0" value="{{ $choice->question_number }}" max="" type="number" name="number"></input><br/>
{!! Form::submit('Шинэчлэх', ['class' => 'btn btn-primary']) !!}
{!! Form::close() !!}
选择模型
protected $fillable = [
'user_id',
'time',
'topic_id',
'question_number'
];
public function topic(){
return $this->belongsTo('App\Topic');
}
我正在尝试通过该输入(此输入的底部)在视图的输入中设置MAX。
就在这里
$duplicates = Question::selectRaw("count('id') as total, topic_id")->with('topic', 'topic.choices')->groupBy('topic_id')->get()->toArray();
array:34 [▼
0 => array:3 [▼
"total" => 30 <<<<<<<< TRYING TO SET BY MAX
"topic_id" => 1
"topic" => array:6 [▶]
]