Test Setup Failed
Pull Request — master (#610)
by Mohamed
14:20
created
app/Models/Student_guardian.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 use Illuminate\Database\Eloquent\SoftDeletes;
8 8
 use Webpatser\Uuid\Uuid;
9 9
 
10
-class Student_guardian extends Base_Model  {
10
+class Student_guardian extends Base_Model {
11 11
 
12 12
     use SoftDeletes;
13 13
 
@@ -59,19 +59,19 @@  discard block
 block discarded – undo
59 59
     public static function boot()
60 60
     {
61 61
         parent::boot();
62
-        self::creating(function ($model) {
62
+        self::creating(function($model) {
63 63
             $model->id = (string) Uuid::generate(4);
64 64
             $model->created_user_id = 1;
65 65
         });
66 66
     }
67 67
 
68
-    public static function createStudentGuardian($student,$guardian,$user){
68
+    public static function createStudentGuardian($student, $guardian, $user) {
69 69
      
70 70
         $exist = self::where('student_id', $student->student_id)
71 71
         ->where('guardian_relation_id', $guardian->guardian_relation_id)
72 72
         ->exists();
73 73
 
74
-        $totalGuardians = self::where('student_id',$student->student_id)->count();
74
+        $totalGuardians = self::where('student_id', $student->student_id)->count();
75 75
 
76 76
         $data = [
77 77
             'student_id' => $student->student_id,
@@ -79,13 +79,13 @@  discard block
 block discarded – undo
79 79
             'guardian_relation_id' => $guardian->guardian_relation_id,
80 80
             'created_user_id' => $user
81 81
         ];
82
-        if(!$exist){
82
+        if (!$exist) {
83 83
             $data['created'] = now();
84 84
             self::create($data);
85
-        }else{
85
+        }else {
86 86
             $data['modified'] = now();
87
-            self::where('student_id' , $student->student_id)
88
-            ->where('guardian_relation_id',$guardian->guardian_relation_id)
87
+            self::where('student_id', $student->student_id)
88
+            ->where('guardian_relation_id', $guardian->guardian_relation_id)
89 89
             ->update($data);
90 90
         }
91 91
     }
Please login to merge, or discard this patch.
app/Models/Institution_shift.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 
5 5
 use Illuminate\Database\Eloquent\Model;
6 6
 
7
-class Institution_shift extends Base_Model  {
7
+class Institution_shift extends Base_Model {
8 8
 
9 9
     /**
10 10
      * The database table used by the model.
@@ -41,40 +41,40 @@  discard block
 block discarded – undo
41 41
      */
42 42
     protected $dates = ['modified', 'created'];
43 43
 
44
-    public function shiftExists($shift){
44
+    public function shiftExists($shift) {
45 45
        return self::query()
46
-            ->where('institution_id',$shift['institution_id'])
47
-            ->where('location_institution_id',$shift['location_institution_id'])
48
-            ->where('shift_option_id',$shift['shift_option_id'])
49
-            ->where('academic_period_id',$shift['academic_period_id'])->exists();
46
+            ->where('institution_id', $shift['institution_id'])
47
+            ->where('location_institution_id', $shift['location_institution_id'])
48
+            ->where('shift_option_id', $shift['shift_option_id'])
49
+            ->where('academic_period_id', $shift['academic_period_id'])->exists();
50 50
     }
51 51
 
52
-    public function getShift($shift){
52
+    public function getShift($shift) {
53 53
         return self::query()
54
-            ->where('institution_id',$shift['institution_id'])
55
-            ->where('location_institution_id',$shift['location_institution_id'])
56
-            ->where('shift_option_id',$shift['shift_option_id'])
57
-            ->where('academic_period_id',$shift['academic_period_id'])->first();
54
+            ->where('institution_id', $shift['institution_id'])
55
+            ->where('location_institution_id', $shift['location_institution_id'])
56
+            ->where('shift_option_id', $shift['shift_option_id'])
57
+            ->where('academic_period_id', $shift['academic_period_id'])->first();
58 58
     }
59 59
 
60
-    public function getShiftsToClone(string $year,$limit,$mode){
60
+    public function getShiftsToClone(string $year, $limit, $mode) {
61 61
         return self::query()
62 62
             ->select('institution_shifts.*')
63
-            ->join('academic_periods','academic_periods.id','=','institution_shifts.academic_period_id')
64
-            ->where('academic_periods.code',$year)
65
-            ->whereNotIn('institution_shifts.cloned',[ !$mode ? '2020' : '2018/2019'])
63
+            ->join('academic_periods', 'academic_periods.id', '=', 'institution_shifts.academic_period_id')
64
+            ->where('academic_periods.code', $year)
65
+            ->whereNotIn('institution_shifts.cloned', [!$mode ? '2020' : '2018/2019'])
66 66
             ->groupBy('institution_shifts.id')
67 67
             ->limit($limit)
68 68
             ->get()
69 69
             ->toArray();
70 70
     }
71 71
 
72
-    public function getShiftsTodelete(string $year,$academic_period_id){
72
+    public function getShiftsTodelete(string $year, $academic_period_id) {
73 73
         return self::query()
74 74
             // ->select('institution_shifts.*','academic_periods.academic_period_id')
75
-            ->join('academic_periods','academic_periods.id','=','institution_shifts.academic_period_id')
76
-            ->where('academic_period_id',$academic_period_id)
77
-            ->where('institution_shifts.cloned',$year)
75
+            ->join('academic_periods', 'academic_periods.id', '=', 'institution_shifts.academic_period_id')
76
+            ->where('academic_period_id', $academic_period_id)
77
+            ->where('institution_shifts.cloned', $year)
78 78
             ->get()->toArray();
79 79
     }
80 80
 }
Please login to merge, or discard this patch.
app/Models/Education_grade.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
app/Models/Institution_student.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
app/Models/Institution_subject.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
app/Models/Institution_class.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -75,9 +75,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
app/Console/Commands/UpdateClassEntriyWithZeroId.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -51,10 +51,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
app/Console/Commands/CallPromotionCommand.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -47,12 +47,12 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
app/Console/Commands/RemoveDuplicatedGuardians.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -45,14 +45,14 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.