public function store(Request $request, $lecture_id, $subject_id, $topic_id, $knowledgeunit_id) { $this->validate($request, ['title' => 'required', 'description' => 'required']); $knowledgeUnit = KnowledgeUnit::find($knowledgeunit_id); Log::info('$knowledgeUnit: ' . $knowledgeUnit->title); $question = new Question(); $question->title = $request->title; $question->description = $request->description; $question->knowledge_unit()->associate($knowledgeUnit); $question->save(); return redirect('/lectures/' . $lecture_id . '/subjects/' . $subject_id . '/topics/' . $topic_id . '/knowledgeunits/' . $knowledgeunit_id . '/questions'); }