I don't know what you're trying to do... your queries make no sense. Why not get the Student with its associated examrecords like this:
// $data = Student::where('id', $student_id)->first(); // NOT NEEDED
// $examsrecords =Student::with('examsrecord')->where('id', $student_id)->get(); // rubbish
$student = Student::with('examsrecord')->find($student_id);
Now, you have the $student instance, and the $student->examrecords Collection both available in the view whenever you pass $student to the template.
I have not idea what this query is about:
$students = StudentExams::select('exams_type', 'exams_year','subject_name', 'obtained_marks')->where('id', $student_id)->get()->all();
Why is the StudentExams model being queries against $student_id??? What are you actually trying to fetch here???
You need better discipline when naming your variables.