@@ -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(empty($gradeOptions) && !is_null($nextProgramme)){ |
|
| 53 | - $programmeId = $nextProgramme->next_programme_id; |
|
| 54 | - $gradeOptions = self::where( 'education_programme_id',$programmeId |
|
| 52 | + if (empty($gradeOptions) && !is_null($nextProgramme)) { |
|
| 53 | + $programmeId = $nextProgramme->next_programme_id; |
|
| 54 | + $gradeOptions = self::where('education_programme_id', $programmeId |
|
| 55 | 55 | )->get()->first(); |
| 56 | 56 | } |
| 57 | 57 | // Default is to get the list of grades with the next programme grades |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | // $results = $gradeOptions; |
| 67 | 67 | // } |
| 68 | 68 | return $gradeOptions; |
| 69 | - } else { |
|
| 69 | + }else { |
|
| 70 | 70 | return null; |
| 71 | 71 | } |
| 72 | 72 | } |
@@ -78,15 +78,15 @@ discard block |
||
| 78 | 78 | |
| 79 | 79 | foreach ($nextProgrammeList as $nextProgrammeId) { |
| 80 | 80 | $nextProgrammeGradeResults = self:: |
| 81 | - where('education_programme_id',$nextProgrammeId->next_programme_id)->get()->toArray(); |
|
| 81 | + where('education_programme_id', $nextProgrammeId->next_programme_id)->get()->toArray(); |
|
| 82 | 82 | |
| 83 | 83 | $results = $results + [key($nextProgrammeGradeResults) => current($nextProgrammeGradeResults)]; |
| 84 | 84 | } |
| 85 | - } else { |
|
| 85 | + }else { |
|
| 86 | 86 | $results = []; |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - return (object)$results; |
|
| 89 | + return (object) $results; |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | |
@@ -100,9 +100,9 @@ discard block |
||
| 100 | 100 | |
| 101 | 101 | $nextProgrammeList = $this->getNextProgrammeList($id); |
| 102 | 102 | if (!empty($nextProgrammeList)) { |
| 103 | - $results = self::whereIn('education_programme_id',$nextProgrammeList) |
|
| 103 | + $results = self::whereIn('education_programme_id', $nextProgrammeList) |
|
| 104 | 104 | ->get()->toArray(); |
| 105 | - } else { |
|
| 105 | + }else { |
|
| 106 | 106 | $results = []; |
| 107 | 107 | } |
| 108 | 108 | |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | * @return array List of next education programmes id |
| 117 | 117 | */ |
| 118 | 118 | public function getNextProgrammeList($id) { |
| 119 | - return Education_programmes_next_programme::where('education_programme_id',$id) |
|
| 119 | + return Education_programmes_next_programme::where('education_programme_id', $id) |
|
| 120 | 120 | ->get()->first(); |
| 121 | 121 | } |
| 122 | 122 | |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | public static function boot() |
| 72 | 72 | { |
| 73 | 73 | parent::boot(); |
| 74 | - self::creating(function ($model) { |
|
| 74 | + self::creating(function($model) { |
|
| 75 | 75 | $model->id = (string) Uuid::generate(4); |
| 76 | 76 | $model->created = now(); |
| 77 | 77 | }); |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | */ |
| 143 | 143 | public static function createExaminationData($student, $admissionInfo) |
| 144 | 144 | { |
| 145 | - $student['sp_center'] = gettype((int)$student['sp_center']) == 'integer' ? $student['sp_center'] : 0; |
|
| 145 | + $student['sp_center'] = gettype((int) $student['sp_center']) == 'integer' ? $student['sp_center'] : 0; |
|
| 146 | 146 | try { |
| 147 | 147 | self::create([ |
| 148 | 148 | 'id' => (string) Uuid::generate(4), |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | 'created' => now(), |
| 168 | 168 | 'created_user_id' => 1 |
| 169 | 169 | ]); |
| 170 | - } catch (\Throwable $th) { |
|
| 170 | + }catch (\Throwable $th) { |
|
| 171 | 171 | Log::error($th); |
| 172 | 172 | } |
| 173 | 173 | } |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | */ |
| 182 | 182 | public static function updateExaminationData($student, $admissionInfo) |
| 183 | 183 | { |
| 184 | - $student['sp_center'] = gettype((int)$student['sp_center']) == 'integer' ? $student['sp_center'] : 0; |
|
| 184 | + $student['sp_center'] = gettype((int) $student['sp_center']) == 'integer' ? $student['sp_center'] : 0; |
|
| 185 | 185 | try { |
| 186 | 186 | self::where([ |
| 187 | 187 | 'student_id' => $student['student_id'], |
@@ -202,50 +202,50 @@ discard block |
||
| 202 | 202 | 'modified_user_id' => 1 |
| 203 | 203 | ] |
| 204 | 204 | ); |
| 205 | - } catch (\Throwable $th) { |
|
| 205 | + }catch (\Throwable $th) { |
|
| 206 | 206 | Log::error($th); |
| 207 | 207 | } |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | - public static function updateStudentArea(array $student){ |
|
| 211 | - $father = Student_guardian::where('student_id',$student['student_id']) |
|
| 212 | - ->join('security_users as sg','guardian_id', 'sg.id') |
|
| 213 | - ->where('guardian_relation_id',1) |
|
| 210 | + public static function updateStudentArea(array $student) { |
|
| 211 | + $father = Student_guardian::where('student_id', $student['student_id']) |
|
| 212 | + ->join('security_users as sg', 'guardian_id', 'sg.id') |
|
| 213 | + ->where('guardian_relation_id', 1) |
|
| 214 | 214 | ->get()->first(); |
| 215 | 215 | |
| 216 | - $mother = Student_guardian::where('student_id',$student['student_id']) |
|
| 217 | - ->join('security_users as sg','guardian_id', 'sg.id') |
|
| 218 | - ->where('guardian_relation_id',2) |
|
| 216 | + $mother = Student_guardian::where('student_id', $student['student_id']) |
|
| 217 | + ->join('security_users as sg', 'guardian_id', 'sg.id') |
|
| 218 | + ->where('guardian_relation_id', 2) |
|
| 219 | 219 | ->get()->first(); |
| 220 | 220 | |
| 221 | - $guardian = Student_guardian::where('student_id',$student['student_id']) |
|
| 222 | - ->join('security_users as sg','guardian_id', 'sg.id') |
|
| 223 | - ->where('guardian_relation_id',3) |
|
| 221 | + $guardian = Student_guardian::where('student_id', $student['student_id']) |
|
| 222 | + ->join('security_users as sg', 'guardian_id', 'sg.id') |
|
| 223 | + ->where('guardian_relation_id', 3) |
|
| 224 | 224 | ->get()->first(); |
| 225 | 225 | |
| 226 | - if(!is_null($father) && is_null($mother) && is_null($guardian)){ |
|
| 227 | - Security_user::where('id',$student['student_id']) |
|
| 226 | + if (!is_null($father) && is_null($mother) && is_null($guardian)) { |
|
| 227 | + Security_user::where('id', $student['student_id']) |
|
| 228 | 228 | ->update(['address_area_id' => $father->address_area_id]); |
| 229 | - }elseif(!is_null($mother) && (is_null($father) && is_null($guardian))){ |
|
| 230 | - Security_user::where('id',$student['student_id']) |
|
| 229 | + }elseif (!is_null($mother) && (is_null($father) && is_null($guardian))) { |
|
| 230 | + Security_user::where('id', $student['student_id']) |
|
| 231 | 231 | ->update(['address_area_id' => $mother->address_area_id]); |
| 232 | - }elseif(!is_null($guardian) && is_null($father) && is_null($mother)){ |
|
| 233 | - Security_user::where('id',$student['student_id']) |
|
| 232 | + }elseif (!is_null($guardian) && is_null($father) && is_null($mother)) { |
|
| 233 | + Security_user::where('id', $student['student_id']) |
|
| 234 | 234 | ->update(['address_area_id' => $guardian->address_area_id]); |
| 235 | - }elseif(!is_null($mother) && !is_null($father) && ($father->address_area_id == $mother->address_area_id)){ |
|
| 236 | - Security_user::where('id',$student['student_id']) |
|
| 235 | + }elseif (!is_null($mother) && !is_null($father) && ($father->address_area_id == $mother->address_area_id)) { |
|
| 236 | + Security_user::where('id', $student['student_id']) |
|
| 237 | 237 | ->update(['address_area_id' => $mother->address_area_id]); |
| 238 | - }elseif(!is_null($mother) && !is_null($father) && ($father->address_area_id !== $mother->address_area_id) && !is_null($guardian)){ |
|
| 239 | - Security_user::where('id',$student['student_id']) |
|
| 238 | + }elseif (!is_null($mother) && !is_null($father) && ($father->address_area_id !== $mother->address_area_id) && !is_null($guardian)) { |
|
| 239 | + Security_user::where('id', $student['student_id']) |
|
| 240 | 240 | ->update(['address_area_id' => $guardian->address_area_id]); |
| 241 | - }elseif(!is_null($father) && $father->address == $student['address']){ |
|
| 242 | - Security_user::where('id',$student['student_id']) |
|
| 241 | + }elseif (!is_null($father) && $father->address == $student['address']) { |
|
| 242 | + Security_user::where('id', $student['student_id']) |
|
| 243 | 243 | ->update(['address_area_id' => $guardian->address_area_id]); |
| 244 | - }elseif(!is_null($mother) && $mother->address == $student['address']){ |
|
| 245 | - Security_user::where('id',$student['student_id']) |
|
| 244 | + }elseif (!is_null($mother) && $mother->address == $student['address']) { |
|
| 245 | + Security_user::where('id', $student['student_id']) |
|
| 246 | 246 | ->update(['address_area_id' => $mother->address_area_id]); |
| 247 | - }elseif(!is_null($guardian) && $guardian->address == $student['address']){ |
|
| 248 | - Security_user::where('id',$student['student_id']) |
|
| 247 | + }elseif (!is_null($guardian) && $guardian->address == $student['address']) { |
|
| 248 | + Security_user::where('id', $student['student_id']) |
|
| 249 | 249 | ->update(['address_area_id' => $guardian->address_area_id]); |
| 250 | 250 | } |
| 251 | 251 | } |
@@ -226,25 +226,25 @@ |
||
| 226 | 226 | if(!is_null($father) && is_null($mother) && is_null($guardian)){ |
| 227 | 227 | Security_user::where('id',$student['student_id']) |
| 228 | 228 | ->update(['address_area_id' => $father->address_area_id]); |
| 229 | - }elseif(!is_null($mother) && (is_null($father) && is_null($guardian))){ |
|
| 229 | + } elseif(!is_null($mother) && (is_null($father) && is_null($guardian))){ |
|
| 230 | 230 | Security_user::where('id',$student['student_id']) |
| 231 | 231 | ->update(['address_area_id' => $mother->address_area_id]); |
| 232 | - }elseif(!is_null($guardian) && is_null($father) && is_null($mother)){ |
|
| 232 | + } elseif(!is_null($guardian) && is_null($father) && is_null($mother)){ |
|
| 233 | 233 | Security_user::where('id',$student['student_id']) |
| 234 | 234 | ->update(['address_area_id' => $guardian->address_area_id]); |
| 235 | - }elseif(!is_null($mother) && !is_null($father) && ($father->address_area_id == $mother->address_area_id)){ |
|
| 235 | + } elseif(!is_null($mother) && !is_null($father) && ($father->address_area_id == $mother->address_area_id)){ |
|
| 236 | 236 | Security_user::where('id',$student['student_id']) |
| 237 | 237 | ->update(['address_area_id' => $mother->address_area_id]); |
| 238 | - }elseif(!is_null($mother) && !is_null($father) && ($father->address_area_id !== $mother->address_area_id) && !is_null($guardian)){ |
|
| 238 | + } elseif(!is_null($mother) && !is_null($father) && ($father->address_area_id !== $mother->address_area_id) && !is_null($guardian)){ |
|
| 239 | 239 | Security_user::where('id',$student['student_id']) |
| 240 | 240 | ->update(['address_area_id' => $guardian->address_area_id]); |
| 241 | - }elseif(!is_null($father) && $father->address == $student['address']){ |
|
| 241 | + } elseif(!is_null($father) && $father->address == $student['address']){ |
|
| 242 | 242 | Security_user::where('id',$student['student_id']) |
| 243 | 243 | ->update(['address_area_id' => $guardian->address_area_id]); |
| 244 | - }elseif(!is_null($mother) && $mother->address == $student['address']){ |
|
| 244 | + } elseif(!is_null($mother) && $mother->address == $student['address']){ |
|
| 245 | 245 | Security_user::where('id',$student['student_id']) |
| 246 | 246 | ->update(['address_area_id' => $mother->address_area_id]); |
| 247 | - }elseif(!is_null($guardian) && $guardian->address == $student['address']){ |
|
| 247 | + } elseif(!is_null($guardian) && $guardian->address == $student['address']){ |
|
| 248 | 248 | Security_user::where('id',$student['student_id']) |
| 249 | 249 | ->update(['address_area_id' => $guardian->address_area_id]); |
| 250 | 250 | } |
@@ -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,52 +42,52 @@ 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, $al = false){ |
|
| 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, $al = false) { |
|
| 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 | ->join('education_programmes', 'education_grades.education_programme_id', 'education_programmes.id') |
| 70 | - ->join('education_cycles', 'education_programmes.education_cycle_id','education_cycles.id'); |
|
| 70 | + ->join('education_cycles', 'education_programmes.education_cycle_id', 'education_cycles.id'); |
|
| 71 | 71 | |
| 72 | 72 | if ($al == true) { |
| 73 | - $query->whereIn('education_programmes.education_cycle_id', [4,5]); |
|
| 74 | - } else { |
|
| 75 | - $query->whereNotIn('education_programmes.education_cycle_id', [4,5]); |
|
| 73 | + $query->whereIn('education_programmes.education_cycle_id', [4, 5]); |
|
| 74 | + }else { |
|
| 75 | + $query->whereNotIn('education_programmes.education_cycle_id', [4, 5]); |
|
| 76 | 76 | } |
| 77 | 77 | return $query->get()->toArray(); |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | public static function getStudentsCount($institution_subject_id) |
| 81 | 81 | { |
| 82 | - $total_male_students = self::with(['student' => function ($query) { |
|
| 82 | + $total_male_students = self::with(['student' => function($query) { |
|
| 83 | 83 | $query->where('student.gender_id', '=', 1); |
| 84 | - }])->whereHas('student', function ($query) { |
|
| 84 | + }])->whereHas('student', function($query) { |
|
| 85 | 85 | $query->where('gender_id', '=', 1); |
| 86 | 86 | })->where('institution_subject_id', '=', $institution_subject_id)->count(); |
| 87 | 87 | |
| 88 | - $total_female_students = self::with(['student' => function ($query) { |
|
| 88 | + $total_female_students = self::with(['student' => function($query) { |
|
| 89 | 89 | $query->where('student.gender_id', '=', 2); |
| 90 | - }])->whereHas('student', function ($query) { |
|
| 90 | + }])->whereHas('student', function($query) { |
|
| 91 | 91 | $query->where('gender_id', '=', 2); |
| 92 | 92 | })->where('institution_subject_id', '=', $institution_subject_id)->count(); |
| 93 | 93 | |
@@ -75,9 +75,9 @@ discard block |
||
| 75 | 75 | |
| 76 | 76 | ) |
| 77 | 77 | ->join('institution_class_grades', 'institution_classes.id', 'institution_class_grades.institution_class_id') |
| 78 | - ->join('education_grades','institution_class_grades.education_grade_id','education_grades.id') |
|
| 78 | + ->join('education_grades', 'institution_class_grades.education_grade_id', 'education_grades.id') |
|
| 79 | 79 | ->join('education_programmes', 'education_grades.education_programme_id', 'education_programmes.id') |
| 80 | - ->join('education_cycles', 'education_programmes.education_cycle_id','education_cycles.id') |
|
| 80 | + ->join('education_cycles', 'education_programmes.education_cycle_id', 'education_cycles.id') |
|
| 81 | 81 | ->groupBy('institution_classes.id'); |
| 82 | 82 | |
| 83 | 83 | if ($al == true) { |
@@ -87,8 +87,8 @@ discard block |
||
| 87 | 87 | ->groupBy('institution_classes.id') |
| 88 | 88 | ->get()->toArray(); |
| 89 | 89 | return $data; |
| 90 | - } else { |
|
| 91 | - $query->where('education_programmes.education_cycle_id','<>',4) |
|
| 90 | + }else { |
|
| 91 | + $query->where('education_programmes.education_cycle_id', '<>', 4) |
|
| 92 | 92 | ->where('institution_id', $shift['institution_id']); |
| 93 | 93 | $data = $query |
| 94 | 94 | ->groupBy('institution_classes.id') |
@@ -97,13 +97,13 @@ discard block |
||
| 97 | 97 | } |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - public static function getGradeClasses($education_grade_id,$institution_id){ |
|
| 100 | + public static function getGradeClasses($education_grade_id, $institution_id) { |
|
| 101 | 101 | return self::query() |
| 102 | - ->select('institution_classes.id','institution_classes.institution_id','institution_classes.institution_shift_id', |
|
| 103 | - 'institution_classes.name','institution_classes.no_of_students','institution_classes.class_number','institution_class_grades.education_grade_id') |
|
| 104 | - ->where('institution_class_grades.education_grade_id',$education_grade_id) |
|
| 105 | - ->where('institution_classes.institution_id',$institution_id) |
|
| 106 | - ->join('institution_class_grades','institution_classes.id','institution_class_grades.institution_class_id') |
|
| 102 | + ->select('institution_classes.id', 'institution_classes.institution_id', 'institution_classes.institution_shift_id', |
|
| 103 | + 'institution_classes.name', 'institution_classes.no_of_students', 'institution_classes.class_number', 'institution_class_grades.education_grade_id') |
|
| 104 | + ->where('institution_class_grades.education_grade_id', $education_grade_id) |
|
| 105 | + ->where('institution_classes.institution_id', $institution_id) |
|
| 106 | + ->join('institution_class_grades', 'institution_classes.id', 'institution_class_grades.institution_class_id') |
|
| 107 | 107 | ->get()->toArray(); |
| 108 | 108 | } |
| 109 | 109 | |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | public function process($student) |
| 76 | 76 | { |
| 77 | - try{ |
|
| 77 | + try{ |
|
| 78 | 78 | $wrongStudentsClass = Institution_class_student::where('institution_id', $student['institution_id']) |
| 79 | 79 | ->whereRaw('institution_class_id not in (select id from institution_classes where institution_id ='.$student['institution_id'].' )') |
| 80 | 80 | ->orWhere('institution_class_id', 0) |
@@ -142,8 +142,8 @@ discard block |
||
| 142 | 142 | array_walk($institutionClassStudent, array($this->class, 'updateClassCount')); |
| 143 | 143 | } |
| 144 | 144 | } |
| 145 | - }catch(\Exception $e){ |
|
| 145 | + }catch(\Exception $e){ |
|
| 146 | 146 | dd($e); |
| 147 | - } |
|
| 147 | + } |
|
| 148 | 148 | } |
| 149 | 149 | } |
@@ -51,10 +51,10 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | if ($this->argument('code') !== 'All') { |
| 53 | 53 | $institutions = Institution::where('code', $this->argument('code'))->get()->toArray(); |
| 54 | - processParallel(array($this,'processInstitution'),$institutions,$this->argument('max')); |
|
| 55 | - } else { |
|
| 54 | + processParallel(array($this, 'processInstitution'), $institutions, $this->argument('max')); |
|
| 55 | + }else { |
|
| 56 | 56 | $institutions = Institution::where('institution_status_id', 1)->get()->toArray(); |
| 57 | - processParallel(array($this,'processInstitution'),$institutions,$this->argument('max')); |
|
| 57 | + processParallel(array($this, 'processInstitution'), $institutions, $this->argument('max')); |
|
| 58 | 58 | } |
| 59 | 59 | } |
| 60 | 60 | |
@@ -65,16 +65,16 @@ discard block |
||
| 65 | 65 | ->where('institutions.id', $institution['id']) |
| 66 | 66 | ->get()->toArray(); |
| 67 | 67 | if (count($students) > 0) { |
| 68 | - array_walk($students,array($this, 'process')); |
|
| 69 | - $this->output->writeln("institution :" .$institution['code']. ' cleaned'); |
|
| 70 | - } else { |
|
| 71 | - $this->output->writeln("all records are cleaned at :".$institution['code'] ); |
|
| 68 | + array_walk($students, array($this, 'process')); |
|
| 69 | + $this->output->writeln("institution :".$institution['code'].' cleaned'); |
|
| 70 | + }else { |
|
| 71 | + $this->output->writeln("all records are cleaned at :".$institution['code']); |
|
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | public function process($student) |
| 76 | 76 | { |
| 77 | - try{ |
|
| 77 | + try { |
|
| 78 | 78 | $wrongStudentsClass = Institution_class_student::where('institution_id', $student['institution_id']) |
| 79 | 79 | ->whereRaw('institution_class_id not in (select id from institution_classes where institution_id ='.$student['institution_id'].' )') |
| 80 | 80 | ->orWhere('institution_class_id', 0) |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | |
| 89 | 89 | array_walk($wrongStudentsClass, array($this->class, 'updateClassCount')); |
| 90 | 90 | |
| 91 | - $institutionClass = Institution_class::getGradeClasses($student['education_grade_id'], $student['institution_id']); |
|
| 91 | + $institutionClass = Institution_class::getGradeClasses($student['education_grade_id'], $student['institution_id']); |
|
| 92 | 92 | |
| 93 | 93 | if (count($institutionClass) == 1) { |
| 94 | 94 | $start_date = new Carbon($student['start_date']); |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | array_walk($institutionClassStudent, array($this->class, 'updateClassCount')); |
| 143 | 143 | } |
| 144 | 144 | } |
| 145 | - }catch(\Exception $e){ |
|
| 145 | + }catch (\Exception $e) { |
|
| 146 | 146 | dd($e); |
| 147 | 147 | } |
| 148 | 148 | } |
@@ -142,7 +142,7 @@ |
||
| 142 | 142 | array_walk($institutionClassStudent, array($this->class, 'updateClassCount')); |
| 143 | 143 | } |
| 144 | 144 | } |
| 145 | - }catch(\Exception $e){ |
|
| 145 | + } catch(\Exception $e){ |
|
| 146 | 146 | dd($e); |
| 147 | 147 | } |
| 148 | 148 | } |
@@ -47,12 +47,12 @@ |
||
| 47 | 47 | $limit = $this->argument('limit'); |
| 48 | 48 | $academicPeriod = $this->academic_period->getAcademicPeriod($year); |
| 49 | 49 | $previousAcademicPeriodYear = $academicPeriod->order; |
| 50 | - $previousAcademicPeriod = Academic_period::where('order',$previousAcademicPeriodYear+1)->first(); |
|
| 51 | - $institutions = $this->instituion_grade->getInstitutionGradeList($previousAcademicPeriod->code,$limit); |
|
| 52 | - array_walk($institutions,array($this,'callPromotion'),$year); |
|
| 50 | + $previousAcademicPeriod = Academic_period::where('order', $previousAcademicPeriodYear + 1)->first(); |
|
| 51 | + $institutions = $this->instituion_grade->getInstitutionGradeList($previousAcademicPeriod->code, $limit); |
|
| 52 | + array_walk($institutions, array($this, 'callPromotion'), $year); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - protected function callPromotion($institution,$count,$year){ |
|
| 56 | - $this->call('promote:students',['year' => $year,'institution' => $institution['code']]); |
|
| 55 | + protected function callPromotion($institution, $count, $year) { |
|
| 56 | + $this->call('promote:students', ['year' => $year, 'institution' => $institution['code']]); |
|
| 57 | 57 | } |
| 58 | 58 | } |
@@ -52,16 +52,16 @@ |
||
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | public function delete(){ |
| 55 | - try{ |
|
| 56 | - DB::statement("UPDATE student_guardians t1 |
|
| 55 | + try{ |
|
| 56 | + DB::statement("UPDATE student_guardians t1 |
|
| 57 | 57 | INNER JOIN student_guardians t2 |
| 58 | 58 | set t1.deleted_at=now() |
| 59 | 59 | WHERE |
| 60 | 60 | t1.id > t2.id AND |
| 61 | 61 | t1.student_id = t2.student_id AND |
| 62 | 62 | t1.guardian_id = t2.guardian_id"); |
| 63 | - }catch(\Exception $e){ |
|
| 64 | - dd($e); |
|
| 65 | - } |
|
| 63 | + }catch(\Exception $e){ |
|
| 64 | + dd($e); |
|
| 65 | + } |
|
| 66 | 66 | } |
| 67 | 67 | } |
@@ -45,14 +45,14 @@ discard block |
||
| 45 | 45 | $this->output->writeln('############### Starting delete Duplication ################'); |
| 46 | 46 | Student_guardian::withTrashed()->restore(); |
| 47 | 47 | $this->delete(); |
| 48 | - $this->end_time = microtime(TRUE); |
|
| 49 | - $this->output->writeln('The cook took ' . ($this->end_time - $this->start_time) . ' seconds to complete'); |
|
| 50 | - } catch (\Throwable $th) { |
|
| 48 | + $this->end_time = microtime(TRUE); |
|
| 49 | + $this->output->writeln('The cook took '.($this->end_time - $this->start_time).' seconds to complete'); |
|
| 50 | + }catch (\Throwable $th) { |
|
| 51 | 51 | } |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - public function delete(){ |
|
| 55 | - try{ |
|
| 54 | + public function delete() { |
|
| 55 | + try { |
|
| 56 | 56 | DB::statement("UPDATE student_guardians t1 |
| 57 | 57 | INNER JOIN student_guardians t2 |
| 58 | 58 | set t1.deleted_at=now() |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | t1.id > t2.id AND |
| 61 | 61 | t1.student_id = t2.student_id AND |
| 62 | 62 | t1.guardian_id = t2.guardian_id"); |
| 63 | - }catch(\Exception $e){ |
|
| 63 | + }catch (\Exception $e) { |
|
| 64 | 64 | dd($e); |
| 65 | 65 | } |
| 66 | 66 | } |
@@ -60,7 +60,7 @@ |
||
| 60 | 60 | t1.id > t2.id AND |
| 61 | 61 | t1.student_id = t2.student_id AND |
| 62 | 62 | t1.guardian_id = t2.guardian_id"); |
| 63 | - }catch(\Exception $e){ |
|
| 63 | + } catch(\Exception $e){ |
|
| 64 | 64 | dd($e); |
| 65 | 65 | } |
| 66 | 66 | } |
@@ -65,14 +65,14 @@ |
||
| 65 | 65 | $institution = $this->argument('institution'); |
| 66 | 66 | $academicPeriod = $this->academic_period->getAcademicPeriod($year); |
| 67 | 67 | $previousAcademicPeriodYear = $academicPeriod->order; |
| 68 | - $previousAcademicPeriod = Academic_period::where('order',$previousAcademicPeriodYear+1)->first(); |
|
| 69 | - $institutionGrade = $this->instituion_grade->getInstitutionGradeToPromoted($previousAcademicPeriod->code,$institution); |
|
| 68 | + $previousAcademicPeriod = Academic_period::where('order', $previousAcademicPeriodYear + 1)->first(); |
|
| 69 | + $institutionGrade = $this->instituion_grade->getInstitutionGradeToPromoted($previousAcademicPeriod->code, $institution); |
|
| 70 | 70 | $output->writeln('Start promoting:'.$institution); |
| 71 | 71 | $params = [ |
| 72 | 72 | 'academicPeriod' => $academicPeriod, |
| 73 | 73 | 'previousAcademicPeriod' => $previousAcademicPeriod |
| 74 | 74 | ]; |
| 75 | - (new BulkPromotion())->callback($institutionGrade,$params); |
|
| 75 | + (new BulkPromotion())->callback($institutionGrade, $params); |
|
| 76 | 76 | $output->writeln('Finished promoting:'.$institution); |
| 77 | 77 | } |
| 78 | 78 | } |
@@ -54,8 +54,8 @@ discard block |
||
| 54 | 54 | $academicPeriod = $this->academic_period->getAcademicPeriod($year); |
| 55 | 55 | $mode = $this->argument('mode') == 'AL' ? true : false; |
| 56 | 56 | $previousAcademicPeriodYear = $academicPeriod->order; |
| 57 | - $previousAcademicPeriod = Academic_period::where('order',$previousAcademicPeriodYear+1)->first(); |
|
| 58 | - $shift = $this->shifts->getShiftsToClone($previousAcademicPeriod->code,$this->argument(('max')),$mode); |
|
| 57 | + $previousAcademicPeriod = Academic_period::where('order', $previousAcademicPeriodYear + 1)->first(); |
|
| 58 | + $shift = $this->shifts->getShiftsToClone($previousAcademicPeriod->code, $this->argument(('max')), $mode); |
|
| 59 | 59 | $params = [ |
| 60 | 60 | 'year' => $year, |
| 61 | 61 | 'academic_period' => $academicPeriod, |
@@ -63,17 +63,17 @@ discard block |
||
| 63 | 63 | 'mode' => $this->argument('mode') |
| 64 | 64 | ]; |
| 65 | 65 | $function = array($this->clone, 'process'); |
| 66 | - if(count($shift) > 0){ |
|
| 66 | + if (count($shift) > 0) { |
|
| 67 | 67 | // processParallel($function,$shift, $this->argument('max'),$params); |
| 68 | - array_walk($shift,$function,$params); |
|
| 69 | - }else{ |
|
| 68 | + array_walk($shift, $function, $params); |
|
| 69 | + }else { |
|
| 70 | 70 | $this->output->writeln('Nothing to clone'); |
| 71 | 71 | } |
| 72 | 72 | $this->end_time = microtime(TRUE); |
| 73 | 73 | |
| 74 | 74 | |
| 75 | 75 | $this->output->writeln('$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$'); |
| 76 | - $this->output->writeln('The cook took ' . ($this->end_time - $this->start_time) . ' seconds to complete'); |
|
| 76 | + $this->output->writeln('The cook took '.($this->end_time - $this->start_time).' seconds to complete'); |
|
| 77 | 77 | $this->output->writeln('$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$'); |
| 78 | 78 | } |
| 79 | 79 | } |
@@ -66,7 +66,7 @@ |
||
| 66 | 66 | if(count($shift) > 0){ |
| 67 | 67 | // processParallel($function,$shift, $this->argument('max'),$params); |
| 68 | 68 | array_walk($shift,$function,$params); |
| 69 | - }else{ |
|
| 69 | + } else{ |
|
| 70 | 70 | $this->output->writeln('Nothing to clone'); |
| 71 | 71 | } |
| 72 | 72 | $this->end_time = microtime(TRUE); |