I am working on a result management system in laravel, in which a student is enroll in one discipline which is divided in to 8 semester and each semester have multiple courses, these courses are divided in 3groups "compulsory, selective and specialization subject". I made a form through which I am collecting subject marks in a semester. Here is the following code of controller function.
public function add_mid_marks($rollno, $semester)
{
// getting student by rollno and current status is live
$student = Student::where('rollno', $rollno)->where('current_status', 1)->firstOrFail();
// getting courses
// compulsory courses
$compulsory = Course::where('discipline_id', $student->discipline_id)
->where('semester', $student->current_semester)
->where('active', 1)->where('group', 'compulsory')->get();
// selective courses
$selective = Course::where('discipline_id', $student->discipline_id)
->where('semester', $student->current_semester)
->where('active', 1)->where('group', 'selective')->get();
// group courses
$groups = Course::distinct()->where('discipline_id', $student->discipline_id)
->where('semester', $student->current_semester)
->where('active', 1)->where('group','<>' ,'selective')
->where('group', '<>', 'compulsory')->pluck('group');
return view('mid_marks.add_mid_marks', compact('student', 'compulsory', 'selective', 'groups'));
}
following is code from the view code here I want to arrange mid marks and sessional marks fields, but did not get how to arrange and how to name that so that I can easily process data in the controller:
<table class="table" id="compulsory-subject">
<thead>
<tr>
<th>Course Name</th>
<th>Mid Marks</th>
<th>Sessional Marks</th>
</tr>
</thead>
<tbody>
{{--Compulsory Courses--}}
@if ($compulsory)
<tr>
@foreach ($compulsory as $c_s)
<td>
<input type="hidden" name="course_id" value="{{$c_s->id}}">
</td>
<td>
<input type="hidden" name="" value="">
</td>
<td>
<input type="hidden" name="" value="">
</td>
@endforeach
@endif
</tr>
here is the function I want to process submitted date:
public function store_mid_marks(Request $request)
{
//storing logic goes here
}
I will grateful for you help, Thank you.