@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | |
5 | 5 | use Illuminate\Database\Eloquent\Model; |
6 | 6 | |
7 | -class Education_grades_subject extends Model { |
|
7 | +class Education_grades_subject extends Model { |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * The database table used by the model. |
@@ -42,12 +42,12 @@ discard block |
||
42 | 42 | protected $dates = ['modified', 'created']; |
43 | 43 | |
44 | 44 | |
45 | - public function institutionGradeSubject(){ |
|
46 | - return $this->hasMany('App\Models\Institution_subject','education_grade_id','education_grade_id'); |
|
45 | + public function institutionGradeSubject() { |
|
46 | + return $this->hasMany('App\Models\Institution_subject', 'education_grade_id', 'education_grade_id'); |
|
47 | 47 | } |
48 | 48 | |
49 | - public function getGradeSubjects($educationGrade){ |
|
50 | - self::where('education_grade_id',$educationGrade['education_grade_id']) |
|
49 | + public function getGradeSubjects($educationGrade) { |
|
50 | + self::where('education_grade_id', $educationGrade['education_grade_id']) |
|
51 | 51 | ->get() |
52 | 52 | ->toArray(); |
53 | 53 | ; |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | |
5 | 5 | use Illuminate\Database\Eloquent\Model; |
6 | 6 | |
7 | -class Institution_subject extends Base_Model { |
|
7 | +class Institution_subject extends Base_Model { |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * The database table used by the model. |
@@ -42,29 +42,29 @@ discard block |
||
42 | 42 | protected $dates = ['modified', 'created', 'modified', 'created']; |
43 | 43 | |
44 | 44 | |
45 | - public function institutionGradeSubject(){ |
|
46 | - return $this->belongsTo('App\Models\Education_grades_subject','education_subject_id','education_subject_id'); |
|
45 | + public function institutionGradeSubject() { |
|
46 | + return $this->belongsTo('App\Models\Education_grades_subject', 'education_subject_id', 'education_subject_id'); |
|
47 | 47 | } |
48 | 48 | |
49 | - public function institutionOptionalGradeSubject(){ |
|
50 | - return $this->belongsTo('App\Models\Education_grades_subject','education_grade_id','education_grade_id'); |
|
49 | + public function institutionOptionalGradeSubject() { |
|
50 | + return $this->belongsTo('App\Models\Education_grades_subject', 'education_grade_id', 'education_grade_id'); |
|
51 | 51 | } |
52 | 52 | |
53 | - public function institutionMandatoryGradeSubject(){ |
|
54 | - return $this->belongsTo('App\Models\Education_grades_subject','education_grade_id','education_grade_id'); |
|
53 | + public function institutionMandatoryGradeSubject() { |
|
54 | + return $this->belongsTo('App\Models\Education_grades_subject', 'education_grade_id', 'education_grade_id'); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | |
58 | - public function institutionClassSubject(){ |
|
59 | - return $this->hasMany('App\Models\Institution_class_subject','institution_class_id','id'); |
|
58 | + public function institutionClassSubject() { |
|
59 | + return $this->hasMany('App\Models\Institution_class_subject', 'institution_class_id', 'id'); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | |
63 | 63 | |
64 | - public function getInstitutionSubjects($institution_id,$academic_period_id){ |
|
65 | - $query = self::query()->where('institution_id',$institution_id) |
|
66 | - ->where('academic_period_id',$academic_period_id) |
|
67 | - ->join('education_grades_subjects','institution_subjects.education_subject_id','education_grades_subjects.id') |
|
64 | + public function getInstitutionSubjects($institution_id, $academic_period_id) { |
|
65 | + $query = self::query()->where('institution_id', $institution_id) |
|
66 | + ->where('academic_period_id', $academic_period_id) |
|
67 | + ->join('education_grades_subjects', 'institution_subjects.education_subject_id', 'education_grades_subjects.id') |
|
68 | 68 | ->join('education_grades', 'education_grades_subjects.education_grade_id', 'education_grades.id') |
69 | 69 | ->groupBy('education_grades_subjects.id'); |
70 | 70 | return $query->get()->toArray(); |
@@ -72,15 +72,15 @@ discard block |
||
72 | 72 | |
73 | 73 | public static function getStudentsCount($institution_subject_id) |
74 | 74 | { |
75 | - $total_male_students = self::with(['student' => function ($query) { |
|
75 | + $total_male_students = self::with(['student' => function($query) { |
|
76 | 76 | $query->where('student.gender_id', '=', 1); |
77 | - }])->whereHas('student', function ($query) { |
|
77 | + }])->whereHas('student', function($query) { |
|
78 | 78 | $query->where('gender_id', '=', 1); |
79 | 79 | })->where('institution_subject_id', '=', $institution_subject_id)->count(); |
80 | 80 | |
81 | - $total_female_students = self::with(['student' => function ($query) { |
|
81 | + $total_female_students = self::with(['student' => function($query) { |
|
82 | 82 | $query->where('student.gender_id', '=', 2); |
83 | - }])->whereHas('student', function ($query) { |
|
83 | + }])->whereHas('student', function($query) { |
|
84 | 84 | $query->where('gender_id', '=', 2); |
85 | 85 | })->where('institution_subject_id', '=', $institution_subject_id)->count(); |
86 | 86 |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | |
5 | 5 | use Illuminate\Database\Eloquent\Model; |
6 | 6 | |
7 | -class Education_grade extends Model { |
|
7 | +class Education_grade extends Model { |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * The database table used by the model. |
@@ -41,17 +41,17 @@ discard block |
||
41 | 41 | */ |
42 | 42 | protected $dates = ['modified', 'created']; |
43 | 43 | |
44 | - public function getNextGrade($gradeId,$getNextProgrammeGrades = false, $firstGradeOnly = false){ |
|
44 | + public function getNextGrade($gradeId, $getNextProgrammeGrades = false, $firstGradeOnly = false) { |
|
45 | 45 | if (!empty($gradeId)) { |
46 | 46 | $gradeObj = $this->find($gradeId); |
47 | 47 | $programmeId = $gradeObj->education_programme_id; |
48 | 48 | $order = $gradeObj->order; |
49 | - $gradeOptions = self::where( 'education_programme_id',$programmeId |
|
50 | - )->where('order',$order+1)->get()->first(); |
|
49 | + $gradeOptions = self::where('education_programme_id', $programmeId |
|
50 | + )->where('order', $order + 1)->get()->first(); |
|
51 | 51 | $nextProgramme = self::getNextProgrammeList($programmeId); |
52 | - if(is_null($gradeOptions) && !is_null($nextProgramme)){ |
|
53 | - $programmeId = $nextProgramme->next_programme_id; |
|
54 | - $gradeOptions = self::where( 'education_programme_id',$programmeId |
|
52 | + if (is_null($gradeOptions) && !is_null($nextProgramme)) { |
|
53 | + $programmeId = $nextProgramme->next_programme_id; |
|
54 | + $gradeOptions = self::where('education_programme_id', $programmeId |
|
55 | 55 | ) |
56 | 56 | ->orderBy('order') |
57 | 57 | ->get()->first(); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | // $results = $gradeOptions; |
69 | 69 | // } |
70 | 70 | return $gradeOptions; |
71 | - } else { |
|
71 | + }else { |
|
72 | 72 | return null; |
73 | 73 | } |
74 | 74 | } |
@@ -80,15 +80,15 @@ discard block |
||
80 | 80 | |
81 | 81 | foreach ($nextProgrammeList as $nextProgrammeId) { |
82 | 82 | $nextProgrammeGradeResults = self:: |
83 | - where('education_programme_id',$nextProgrammeId->next_programme_id)->get()->toArray(); |
|
83 | + where('education_programme_id', $nextProgrammeId->next_programme_id)->get()->toArray(); |
|
84 | 84 | |
85 | 85 | $results = $results + [key($nextProgrammeGradeResults) => current($nextProgrammeGradeResults)]; |
86 | 86 | } |
87 | - } else { |
|
87 | + }else { |
|
88 | 88 | $results = []; |
89 | 89 | } |
90 | 90 | |
91 | - return (object)$results; |
|
91 | + return (object) $results; |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | |
@@ -102,9 +102,9 @@ discard block |
||
102 | 102 | |
103 | 103 | $nextProgrammeList = $this->getNextProgrammeList($id); |
104 | 104 | if (!empty($nextProgrammeList)) { |
105 | - $results = self::whereIn('education_programme_id',$nextProgrammeList) |
|
105 | + $results = self::whereIn('education_programme_id', $nextProgrammeList) |
|
106 | 106 | ->get()->toArray(); |
107 | - } else { |
|
107 | + }else { |
|
108 | 108 | $results = []; |
109 | 109 | } |
110 | 110 | |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | * @return array List of next education programmes id |
119 | 119 | */ |
120 | 120 | public function getNextProgrammeList($id) { |
121 | - return Education_programmes_next_programme::where('education_programme_id',$id) |
|
121 | + return Education_programmes_next_programme::where('education_programme_id', $id) |
|
122 | 122 | ->get()->first(); |
123 | 123 | } |
124 | 124 |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | public static function boot() |
59 | 59 | { |
60 | 60 | parent::boot(); |
61 | - self::creating(function ($model) { |
|
61 | + self::creating(function($model) { |
|
62 | 62 | $model->id = (string) Uuid::generate(4); |
63 | 63 | $model->created = now(); |
64 | 64 | }); |
@@ -71,15 +71,15 @@ discard block |
||
71 | 71 | |
72 | 72 | public static function getStudentsCount($institution_class_id) |
73 | 73 | { |
74 | - $total_male_students = self::with(['student' => function ($query) { |
|
74 | + $total_male_students = self::with(['student' => function($query) { |
|
75 | 75 | $query->where('student.gender_id', '=', 1); |
76 | - }])->whereHas('student', function ($query) { |
|
76 | + }])->whereHas('student', function($query) { |
|
77 | 77 | $query->where('gender_id', '=', 1); |
78 | 78 | })->where('institution_class_id', '=', $institution_class_id)->count(); |
79 | 79 | |
80 | - $total_female_students = self::with(['student' => function ($query) { |
|
80 | + $total_female_students = self::with(['student' => function($query) { |
|
81 | 81 | $query->where('student.gender_id', '=', 2); |
82 | - }])->whereHas('student', function ($query) { |
|
82 | + }])->whereHas('student', function($query) { |
|
83 | 83 | $query->where('gender_id', '=', 2); |
84 | 84 | })->where('institution_class_id', '=', $institution_class_id)->count(); |
85 | 85 | |
@@ -109,8 +109,8 @@ discard block |
||
109 | 109 | ->where('student_id', $student['student_id']) |
110 | 110 | ->join('institution_classes', 'institution_class_students.institution_class_id', '=', 'institution_classes.id') |
111 | 111 | ->where('institution_class_students.student_id', $student['student_id']) |
112 | - ->where('institution_class_students.academic_period_id',$student['academic_period_id']) |
|
113 | - ->where('institution_class_students.institution_id',$student['institution_id']) |
|
112 | + ->where('institution_class_students.academic_period_id', $student['academic_period_id']) |
|
113 | + ->where('institution_class_students.institution_id', $student['institution_id']) |
|
114 | 114 | ->whereNull('institution_class_students.deleted_at') |
115 | 115 | ->get()->first(); |
116 | 116 | } |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | 'institution_id' => $admissionInfo['instituion']->id, |
135 | 135 | 'student_status_id' => 1 |
136 | 136 | ]); |
137 | - } catch (\Throwable $th) { |
|
137 | + }catch (\Throwable $th) { |
|
138 | 138 | Log::error($th); |
139 | 139 | } |
140 | 140 | } |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | if (!empty($isAvailableforPromotion)) { |
65 | 65 | $this->process($institutionGrade, $nextGrade, $params); |
66 | 66 | DB::commit(); |
67 | - } else { |
|
67 | + }else { |
|
68 | 68 | DB::rollBack(); |
69 | 69 | } |
70 | 70 | //leave school levers |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | // $this->process($institutionGrade, $nextGrade, $params); |
73 | 73 | // } |
74 | 74 | } |
75 | - } catch (\Exception $e) { |
|
75 | + }catch (\Exception $e) { |
|
76 | 76 | DB::rollBack(); |
77 | 77 | } |
78 | 78 | } |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | |
106 | 106 | $output = new \Symfony\Component\Console\Output\ConsoleOutput(); |
107 | 107 | $output->writeln('##########################################################################################################################'); |
108 | - $output->writeln('Promoting from ' . $institutionGrade['name'] . ' IN ' . $institution->name . ' No of Students: ' . count($studentListToPromote)); |
|
108 | + $output->writeln('Promoting from '.$institutionGrade['name'].' IN '.$institution->name.' No of Students: '.count($studentListToPromote)); |
|
109 | 109 | |
110 | 110 | |
111 | 111 | if (!empty($parallelClasses)) { |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | array_walk($parallelClasses, array($this, 'updateStudentCount')); |
121 | 121 | DB::commit(); |
122 | 122 | } |
123 | - } catch (\Exception $e) { |
|
123 | + }catch (\Exception $e) { |
|
124 | 124 | DB::rollBack(); |
125 | 125 | Log::error($e->getMessage()); |
126 | 126 | } |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | $previousAcademicPeriod = $params['previousAcademicPeriod']; |
156 | 156 | $nextGradeObj = null; |
157 | 157 | $currentGradeObj = $this->instituion_grade->getParallelClasses($institutionGrade['id'], $institutionGrade['institution_id'], $institutionGrade['education_grade_id'], $previousAcademicPeriod->id); |
158 | - if ($nextGrade !== [] && !is_null($nextGrade)) { |
|
158 | + if ($nextGrade !== [] && !is_null($nextGrade)) { |
|
159 | 159 | $nextGradeObj = $this->instituion_grade->getParallelClasses($institutionGrade['id'], $institutionGrade['institution_id'], $nextGrade->id, $academicPeriod->id); |
160 | 160 | } |
161 | 161 | |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | // promote parallel classes |
165 | 165 | $this->promotion($institutionGrade, $nextGrade, $previousAcademicPeriod, $academicPeriod, $nextGradeObj->toArray(), 1); |
166 | 166 | return 1; |
167 | - } elseif (($nextGradeObj->count() > 1) && ($nextGradeObj->count() !== $currentGradeObj->count())) { |
|
167 | + } elseif (($nextGradeObj->count() > 1) && ($nextGradeObj->count() !== $currentGradeObj->count())) { |
|
168 | 168 | // promote pool promotion |
169 | 169 | $this->promotion($institutionGrade, $nextGrade, $previousAcademicPeriod, $academicPeriod, [], 1); |
170 | 170 | return 2; |
@@ -172,12 +172,12 @@ discard block |
||
172 | 172 | // Promote matching class name with previous class |
173 | 173 | $this->promotion($institutionGrade, $nextGrade, $previousAcademicPeriod, $academicPeriod, $nextGradeObj->toArray(), 1); |
174 | 174 | return 1; |
175 | - } else { |
|
175 | + }else { |
|
176 | 176 | // default pool promotion |
177 | 177 | $this->promotion($institutionGrade, $nextGrade, $previousAcademicPeriod, $academicPeriod, [], 1); |
178 | 178 | return 2; |
179 | 179 | } |
180 | - } else { |
|
180 | + }else { |
|
181 | 181 | // default pool promotion |
182 | 182 | $this->promotion($institutionGrade, $nextGrade, $previousAcademicPeriod, $academicPeriod, [], 3); |
183 | 183 | return 2; |
@@ -213,10 +213,10 @@ discard block |
||
213 | 213 | ]; |
214 | 214 | |
215 | 215 | try { |
216 | - Institution_student::where('id', (string)$student['id'])->update($studentData); |
|
216 | + Institution_student::where('id', (string) $student['id'])->update($studentData); |
|
217 | 217 | $output = new \Symfony\Component\Console\Output\ConsoleOutput(); |
218 | - $output->writeln('----------------- ' . $student['admission_id'] . ' to ' . $studentData['education_grade_id']); |
|
219 | - } catch (\Exception $e) { |
|
218 | + $output->writeln('----------------- '.$student['admission_id'].' to '.$studentData['education_grade_id']); |
|
219 | + }catch (\Exception $e) { |
|
220 | 220 | Log::error($e->getMessage()); |
221 | 221 | } |
222 | 222 | } |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | $studentClass = $this->institution_class_students->getStudentNewClass($student); |
237 | 237 | if (!is_null($studentClass)) { |
238 | 238 | return array_search(str_replace($educationGrade['name'], $nextGrade->name, $studentClass->name), array_column($classes, 'name')); |
239 | - } else { |
|
239 | + }else { |
|
240 | 240 | return false; |
241 | 241 | } |
242 | 242 | } |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | $class = null; |
259 | 259 | if (count($classes) == 1) { |
260 | 260 | $class = $classes[0]; |
261 | - } else { |
|
261 | + }else { |
|
262 | 262 | $class = $this->getStudentClass($student, $educationGrade, $nextGrade, $classes); |
263 | 263 | if (is_numeric($class)) { |
264 | 264 | $class = $classes[$class]; |
@@ -290,13 +290,13 @@ discard block |
||
290 | 290 | // array_walk($allInsSubjects,array($this,'updateSubjectCount')); |
291 | 291 | // } |
292 | 292 | $output = new \Symfony\Component\Console\Output\ConsoleOutput(); |
293 | - $output->writeln('----------------- ' . $student['student_id'] . 'to ' . $class['name']); |
|
294 | - } else { |
|
295 | - $this->institution_class_students->where('id', (string)$student['id'])->update($studentObj); |
|
293 | + $output->writeln('----------------- '.$student['student_id'].'to '.$class['name']); |
|
294 | + }else { |
|
295 | + $this->institution_class_students->where('id', (string) $student['id'])->update($studentObj); |
|
296 | 296 | $output = new \Symfony\Component\Console\Output\ConsoleOutput(); |
297 | - $output->writeln('----------------- ' . $student['student_id'] . 'to ' . $class['name']); |
|
297 | + $output->writeln('----------------- '.$student['student_id'].'to '.$class['name']); |
|
298 | 298 | } |
299 | - } catch (\Exception $e) { |
|
299 | + }catch (\Exception $e) { |
|
300 | 300 | Log::error($e->getMessage()); |
301 | 301 | } |
302 | 302 | } |
@@ -70,10 +70,10 @@ discard block |
||
70 | 70 | public function getParallelClasses($id, $institutionId, $educationGradeId, $academicPeriodId) |
71 | 71 | { |
72 | 72 | $data = self::find($id)->select('institution_grades.id as insGrade', 'institution_classes.id', 'institution_classes.name', 'institution_grades.education_grade_id') |
73 | - ->join('institution_classes', function ($join) use ($educationGradeId, $academicPeriodId) { |
|
73 | + ->join('institution_classes', function($join) use ($educationGradeId, $academicPeriodId) { |
|
74 | 74 | $join->on('institution_classes.institution_id', '=', 'institution_grades.institution_id') |
75 | 75 | ->where('institution_classes.academic_period_id', $academicPeriodId) |
76 | - ->join('institution_class_grades', function ($join) use ($educationGradeId) { |
|
76 | + ->join('institution_class_grades', function($join) use ($educationGradeId) { |
|
77 | 77 | $join->on('institution_class_grades.institution_class_id', '=', 'institution_classes.id') |
78 | 78 | ->where('institution_class_grades.education_grade_id', $educationGradeId); |
79 | 79 | }) |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | ->select('education_grades.name', 'institutions.code', 'institutions.name as institution_name', 'institution_grades.id', 'institution_grades.institution_id', 'institution_grades.education_grade_id') |
124 | 124 | ->where('promoted', '=', $year) |
125 | 125 | ->join('education_grades', 'institution_grades.education_grade_id', '=', 'education_grades.id') |
126 | - ->join('institutions', function ($join) use ($year, $institution) { |
|
126 | + ->join('institutions', function($join) use ($year, $institution) { |
|
127 | 127 | $join->on('institutions.id', '=', 'institution_grades.institution_id') |
128 | 128 | ->where('institutions.code', '=', $institution); |
129 | 129 | }) |
@@ -151,21 +151,21 @@ discard block |
||
151 | 151 | * @param $year |
152 | 152 | * @return mixed |
153 | 153 | */ |
154 | - public function getInstitutionGradeList($year, $limit,$mode) |
|
154 | + public function getInstitutionGradeList($year, $limit, $mode) |
|
155 | 155 | { |
156 | 156 | $query = $this->select('education_grades.name', 'institutions.code', 'institutions.name as institution_name', 'institution_grades.id', 'institution_grades.institution_id', 'institution_grades.education_grade_id') |
157 | 157 | ->where('promoted', '=', $year) |
158 | 158 | ->join('education_grades', 'institution_grades.education_grade_id', '=', 'education_grades.id') |
159 | - ->join('institutions', function ($join) use ($year) { |
|
159 | + ->join('institutions', function($join) use ($year) { |
|
160 | 160 | $join->on('institutions.id', '=', 'institution_grades.institution_id'); |
161 | 161 | }) |
162 | 162 | ->join('education_programmes', 'education_grades.education_programme_id', 'education_programmes.id'); |
163 | 163 | switch ($mode) { |
164 | 164 | case '1-5': |
165 | - $query->where('education_programmes.education_cycle_id', [1,2]); |
|
165 | + $query->where('education_programmes.education_cycle_id', [1, 2]); |
|
166 | 166 | break; |
167 | 167 | case '6-11': |
168 | - $query->whereIn('education_programmes.education_cycle_id', [2,3,4]); |
|
168 | + $query->whereIn('education_programmes.education_cycle_id', [2, 3, 4]); |
|
169 | 169 | break; |
170 | 170 | case 'AL': |
171 | 171 | $query->where('education_programmes.education_cycle_id', 4); |
@@ -180,13 +180,13 @@ discard block |
||
180 | 180 | return $data; |
181 | 181 | } |
182 | 182 | |
183 | - public function getGradeSubjects($institutionId){ |
|
183 | + public function getGradeSubjects($institutionId) { |
|
184 | 184 | return self::query() |
185 | - ->select('institution_grades.institution_id','education_grades_subjects.education_grade_id','education_grades_subjects.education_subject_id','education_subjects.name') |
|
186 | - ->where('institution_grades.institution_id',$institutionId) |
|
185 | + ->select('institution_grades.institution_id', 'education_grades_subjects.education_grade_id', 'education_grades_subjects.education_subject_id', 'education_subjects.name') |
|
186 | + ->where('institution_grades.institution_id', $institutionId) |
|
187 | 187 | ->join('education_grades', 'institution_grades.education_grade_id', 'education_grades.id') |
188 | - ->join('education_grades_subjects','education_grades.id','education_grades_subjects.education_grade_id') |
|
189 | - ->join('education_subjects','education_grades_subjects.education_subject_id','education_subjects.id') |
|
188 | + ->join('education_grades_subjects', 'education_grades.id', 'education_grades_subjects.education_grade_id') |
|
189 | + ->join('education_subjects', 'education_grades_subjects.education_subject_id', 'education_subjects.id') |
|
190 | 190 | ->groupBy('education_grades_subjects.id') |
191 | 191 | ->get() |
192 | 192 | ->toArray(); |