public function record($student_id, Request $request)
 {
     if (!$student_id) {
         return redirect()->rotue('students.students.index');
     }
     $terms = get_student_grades($student_id);
     $student = Student::findOrFail($student_id);
     if ($request->has('partial')) {
         return view('students::grades._record_list', compact('terms', 'student'));
     }
     return view('students::grades.record', compact('terms', 'student'));
 }
 public function show(Request $request, $student_id)
 {
     $invoices = FinancialInvoice::with('item', 'semester')->where('student_id', $student_id);
     $student = Student::findOrFail($student_id);
     if ($request->has('semester_id')) {
         $invoices->where('semester_id', $request->input('semester_id'));
     }
     $invoices = $invoices->orderBy('created_at', 'ASC')->get();
     $has_search = count($request->all());
     $semesters = Semester::pluck('name', 'id');
     $total_debit = $invoices->sum(function ($invoice) {
         return $invoice->type == 'debit' ? $invoice->amount : 0;
     });
     $total_credit = $invoices->sum(function ($invoice) {
         return $invoice->type == 'credit' ? $invoice->amount : 0;
     });
     if ($request->has('partial')) {
         return view('financials::reports._list', compact('invoices', 'student', 'has_search', 'semesters', 'total_debit', 'total_credit'));
     }
     return view('financials::reports.show', compact('invoices', 'student', 'has_search', 'semesters', 'total_debit', 'total_credit'));
 }
 public function classroomsedit($student_id, $classroom_id)
 {
     $student = Student::findOrFail($student_id);
     //$subjects = Subject::with('classroom')->Student($student->id)->findOrFail($subject_id);
     $subject_id = Classroom::findOrFail($classroom_id)->subject_subject_id;
     $classrooms = Classroom::with('students')->where('subject_subject_id', $subject_id)->get();
     // dd($subject_id);
     // $classroom_id= $classrooms->id;
     return view('students::classrooms.edit', compact('classroom_id', 'student', 'classrooms', 'student_id'));
 }
Exemple #4
0
 public function saveresult($subject_id = 0, $exam_id = 0, $student_id = 0, $exam_type = null)
 {
     # code...
     $exam = Exam::findOrFail($exam_id);
     $student = Student::findOrFail($student_id);
     $grade = config('exams.grade');
     $questions = ExamQuestion::select('exams.id', 'exam_results.id as exam_result_id', 'exam_questions.question_id', 'answer', 'degree', 'qbq.question as questionname', 'qbq.model_answer as modelanswer')->with('question', 'question.choices')->where('exam_questions.exam_id', $exam_id)->join('exams', function ($j) {
         $j->on('exam_questions.exam_id', '=', 'exams.id')->where('exams.semester_id', '=', semester()->id);
     })->join("questionbank_questions AS qbq", "qbq.id", '=', "exam_questions.question_id")->join('exam_results', function ($j) use($student_id) {
         $j->on('exams.id', '=', 'exam_results.exam_id')->where('exam_results.semester_id', '=', semester()->id)->where('exam_results.student_id', '=', $student_id);
     })->join('exam_result_answers', function ($j) {
         $j->on('exam_results.id', '=', 'exam_result_answers.exam_result_id')->on('exam_questions.question_id', '=', 'exam_result_answers.question_id');
     })->where('qbq.type', '=', 'essay')->get();
     return view('teachers::profile.tests.saveresult', compact('questions', 'subject_id', 'exam_id', 'grade', 'exam_type', 'student_id', 'student'));
 }