Thank you siangboon but you did not address my question properly.
First, i do not want an input name "route_id". I know how to do this if i want to but i want the route id from the url ---http://127.0.0.1/my_homework/add_answer/9.....I want to do this right in the controller. The id here for example is 9. I want it stored as homework_id when saving my homework as a student automatically.
Please note that the route_id is same as homework_id. The student answers are stored in an homeworkanswers table which as homework_id as a column as you can see here in the controller :
public function store(Request $request)
{
$homeworkanswer = new \App\HomeworkAnswer();
$homeworkanswer->date = $request->date;
$homeworkanswer->student_id = get_studentid();
$homeworkanswer->homework_id = $request->route_id;
$homeworkanswer->myanswer = $request->myanswer;
$homeworkanswer->save();
public function store(Request $request,$route_id)
{
$homeworkanswer = new \App\HomeworkAnswer();
$homeworkanswer->date = $request->date;
$homeworkanswer->student_id = get_studentid();
$homeworkanswer->homework_id = $route_id;
$homeworkanswer->myanswer = $request->myanswer;
$homeworkanswer->save();
it gave this error -
"Too few arguments to function App\Http\Controllers\Users\StudentController::store_assignmentanswer(), 1 passed and exactly 2 expected"