我只想通过{{ choice_question_number }}
来where('user_id',Auth::id());
。
查看如何检查user_id或如何使用user_id检入控制器。我正在使用问题模型(即问题模型)来提问。
查看
@foreach ($duplicate->topic->choices as $choice)
{{ $choice->question_number }}
@endforeach
控制器
$duplicates = Question::selectRaw("count('id') as total, topic_id")->with('topic', 'topic.choices')->groupBy('topic_id')->get();
return view('choices.index',compact('too','duplicates'));
模型
protected $fillable = [
'user_id',
'time',
'topic_id',
'question_number'
];
public function topic(){
return $this->belongsTo('App\Topic');
}