Test Setup Failed
Pull Request — master (#678)
by Mohamed
08:07
created
app/Imports/Import.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -89,10 +89,10 @@  discard block
 block discarded – undo
89 89
         $highestColumn = $this->worksheet->getHighestDataColumn(3);
90 90
         $higestRow = 0;
91 91
         for ($row = $this->startRow(); $row <= $this->highestRow; $row++) {
92
-            $rowData = $this->worksheet->rangeToArray('A' . $row . ':' . $highestColumn . $row, NULL, TRUE, FALSE);
92
+            $rowData = $this->worksheet->rangeToArray('A'.$row.':'.$highestColumn.$row, NULL, TRUE, FALSE);
93 93
             if (isEmptyRow(reset($rowData))) {
94 94
                 continue;
95
-            } else {
95
+            }else {
96 96
                 $higestRow += 1;
97 97
             }
98 98
         }
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
         $this->failures = [];
107 107
         if (($column !== "") && (!in_array($column, $columns))) {
108 108
             $this->isValidSheet = false;
109
-            $this->error[] = 'Unsupported column found ,remove:' . $column;
109
+            $this->error[] = 'Unsupported column found ,remove:'.$column;
110 110
             $this->failure = new Failure(3, 'remark', $this->error, [null]);
111 111
             $this->failures = new \Maatwebsite\Excel\Validators\ValidationException($error, [$this->failure]);
112 112
         }
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
         foreach ($columns as  $column) {
126 126
             if (($column !== "") && (!in_array($column, $existingColumns))) {
127 127
                 $this->isValidSheet = false;
128
-                $this->error[] = 'Missing Column :' . $column . ' Not found';
128
+                $this->error[] = 'Missing Column :'.$column.' Not found';
129 129
                 $this->failure = new Failure(3, 'remark', $this->error, [null]);
130 130
                 $this->failures = new \Maatwebsite\Excel\Validators\ValidationException($error, [$this->failure]);
131 131
             }
@@ -142,16 +142,16 @@  discard block
 block discarded – undo
142 142
         $highestColumn = $this->worksheet->getHighestDataColumn(3);
143 143
         $higestRow = 1;
144 144
         for ($row = $this->startRow(); $row <= $this->highestRow; $row++) {
145
-            $rowData = $this->worksheet->rangeToArray('A' . $row . ':' . $highestColumn . $row, NULL, TRUE, FALSE);
145
+            $rowData = $this->worksheet->rangeToArray('A'.$row.':'.$highestColumn.$row, NULL, TRUE, FALSE);
146 146
             if (isEmptyRow(reset($rowData))) {
147 147
                 continue;
148
-            } else {
148
+            }else {
149 149
                 $higestRow += 1;
150 150
             }
151 151
         }
152 152
         if ($higestRow == 0) {
153 153
             exit;
154
-        } else {
154
+        }else {
155 155
             return $higestRow;
156 156
         }
157 157
     }
@@ -176,17 +176,17 @@  discard block
 block discarded – undo
176 176
                     case 'string':
177 177
                         $row[$column] = preg_replace('/[^A-Za-z0-9\-]/', '-', $row[$column]);
178 178
                         $row[$column] = date($format, strtotime($row[$column])); //date($row[$column]);
179
-                        $row[$column] =  \Carbon\Carbon::createFromFormat($format, $row[$column]);
179
+                        $row[$column] = \Carbon\Carbon::createFromFormat($format, $row[$column]);
180 180
                         break;
181 181
                     case 'double';
182
-                        $row[$column] =  \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($row[$column]);
182
+                        $row[$column] = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($row[$column]);
183 183
                         break;
184 184
                 }
185 185
             }
186 186
             return $row;
187
-        } catch (Exception $e) {
187
+        }catch (Exception $e) {
188 188
             $error = \Illuminate\Validation\ValidationException::withMessages([]);
189
-            $failure = new Failure(3, 'remark', [0 => 'Template is not valid for upload, use the template given in the system ' . $row[$column] . ' Not a valid date formate'], [null]);
189
+            $failure = new Failure(3, 'remark', [0 => 'Template is not valid for upload, use the template given in the system '.$row[$column].' Not a valid date formate'], [null]);
190 190
             $failures = [0 => $failure];
191 191
             throw new \Maatwebsite\Excel\Validators\ValidationException($error, $failures);
192 192
         }
@@ -207,18 +207,18 @@  discard block
 block discarded – undo
207 207
         $row = $this->formateDate($row, 'mothers_date_of_birth_yyyy_mm_dd');
208 208
         $row = $this->formateDate($row, 'guardians_date_of_birth_yyyy_mm_dd');
209 209
 
210
-        $row['admission_no'] =  str_pad($row['admission_no'], 4, '0', STR_PAD_LEFT);
210
+        $row['admission_no'] = str_pad($row['admission_no'], 4, '0', STR_PAD_LEFT);
211 211
 
212 212
         if (array_key_exists('identity_type', $row)) {
213 213
             if ($row['identity_type'] == 'BC' && (!empty($row['birth_divisional_secretariat'])) && ($row['identity_number'] !== null) && $row['date_of_birth_yyyy_mm_dd'] !== null) {
214
-                $row['identity_number'] =  str_pad($row['identity_number'], 4, '0', STR_PAD_LEFT);
214
+                $row['identity_number'] = str_pad($row['identity_number'], 4, '0', STR_PAD_LEFT);
215 215
                 // dd(($row['date_of_birth_yyyy_mm_dd']));
216
-                $BirthDivision = Area_administrative::where('name', 'like', '%' . $row['birth_divisional_secretariat'] . '%')->where('area_administrative_level_id', '=', 5)->first();
216
+                $BirthDivision = Area_administrative::where('name', 'like', '%'.$row['birth_divisional_secretariat'].'%')->where('area_administrative_level_id', '=', 5)->first();
217 217
                 if ($BirthDivision !== null) {
218
-                    $BirthArea = Area_administrative::where('name', 'like', '%' . $row['birth_registrar_office_as_in_birth_certificate'] . '%')
218
+                    $BirthArea = Area_administrative::where('name', 'like', '%'.$row['birth_registrar_office_as_in_birth_certificate'].'%')
219 219
                         ->where('parent_id', '=', $BirthDivision->id)->first();
220 220
                     if ($BirthArea !== null) {
221
-                        $row['identity_number'] = $BirthArea->id . '' . $row['identity_number'] . '' . substr($row['date_of_birth_yyyy_mm_dd']->format("yy"), -2) . '' . $row['date_of_birth_yyyy_mm_dd']->format("m");
221
+                        $row['identity_number'] = $BirthArea->id.''.$row['identity_number'].''.substr($row['date_of_birth_yyyy_mm_dd']->format("yy"), -2).''.$row['date_of_birth_yyyy_mm_dd']->format("m");
222 222
                     }
223 223
                 }
224 224
             }
@@ -230,9 +230,9 @@  discard block
 block discarded – undo
230 230
     {
231 231
         if (array_key_exists($key, $row)) {
232 232
             return true;
233
-        } else {
233
+        }else {
234 234
             $error = \Illuminate\Validation\ValidationException::withMessages([]);
235
-            $failure = new Failure($count, 'remark', [0 => 'Template is not valid for upload, use the template given in the system ' . $key, ' Is missing form the template'], [null]);
235
+            $failure = new Failure($count, 'remark', [0 => 'Template is not valid for upload, use the template given in the system '.$key, ' Is missing form the template'], [null]);
236 236
             $failures = [0 => $failure];
237 237
             new \Maatwebsite\Excel\Validators\ValidationException($error, $failures);
238 238
         };
@@ -267,11 +267,11 @@  discard block
 block discarded – undo
267 267
         $exceededStudents = ($totalStudents + $this->limit()) > $institutionClass->no_of_students ? true : false;
268 268
         if ($exceededStudents == true) {
269 269
             $error = \Illuminate\Validation\ValidationException::withMessages([]);
270
-            $failure = new Failure(3, 'remark', ['Class student count exceeded! Max number of students is' . $institutionClass->no_of_students], [null]);
270
+            $failure = new Failure(3, 'remark', ['Class student count exceeded! Max number of students is'.$institutionClass->no_of_students], [null]);
271 271
             $failures = [0 => $failure];
272 272
             throw new \Maatwebsite\Excel\Validators\ValidationException($error, $failures);
273 273
             Log::info('email-sent', [$this->file]);
274
-        } else {
274
+        }else {
275 275
             return true;
276 276
         }
277 277
     }
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 
333 333
     public function createOrUpdateGuardian($row, $student, $param)
334 334
     {
335
-        if (!empty($row[$param . 's_full_name']) && ($row[$param . 's_date_of_birth_yyyy_mm_dd'] !== null)) {
335
+        if (!empty($row[$param.'s_full_name']) && ($row[$param.'s_date_of_birth_yyyy_mm_dd'] !== null)) {
336 336
             $guardian = Security_user::createOrUpdateGuardianProfile($row, $param, $this->file);
337 337
             if (!is_null($guardian)) {
338 338
                 Security_user::where('id', '=', $guardian->id)
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
     {
375 375
         $mandatorySubject = Institution_class_subject::getMandatorySubjects($this->file['institution_class_id']);
376 376
         $subjects = getMatchingKeys($row);
377
-        $optionalSubjects =  Institution_class_subject::getStudentOptionalSubject($subjects, $student, $row, $institution);
377
+        $optionalSubjects = Institution_class_subject::getStudentOptionalSubject($subjects, $student, $row, $institution);
378 378
         $allSubjects = array_merge_recursive($optionalSubjects, $mandatorySubject);
379 379
         if (!empty($allSubjects)) {
380 380
             $allSubjects = unique_multidim_array($allSubjects, 'institution_subject_id');
Please login to merge, or discard this patch.
app/Imports/UsersImport.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
     public function registerEvents(): array
76 76
     {
77 77
         return [
78
-            BeforeSheet::class => function (BeforeSheet $event) {
78
+            BeforeSheet::class => function(BeforeSheet $event) {
79 79
                 $this->sheetNames[] = $event->getSheet()->getTitle();
80 80
                 $this->worksheet = $event->getSheet();
81 81
                 $this->validateClass();
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
                     throw new \Maatwebsite\Excel\Validators\ValidationException($error, $failures);
88 88
                 }
89 89
             },
90
-            BeforeImport::class => function (BeforeImport $event) {
90
+            BeforeImport::class => function(BeforeImport $event) {
91 91
                 $this->highestRow = ($event->getReader()->getDelegate()->getActiveSheet()->getHighestDataRow('C'));
92 92
                 if ($this->highestRow < 3) {
93 93
                     $error = \Illuminate\Validation\ValidationException::withMessages([]);
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 
114 114
             if (!empty($institutionClass)) {
115 115
                 $row = $this->setGender($row);
116
-                $studentInfo = Security_user::createOrUpdateStudentProfile($row,'create',$this->file);  
116
+                $studentInfo = Security_user::createOrUpdateStudentProfile($row, 'create', $this->file);  
117 117
                 $academicPeriod = Academic_period::where('id', '=', $institutionClass->academic_period_id)->first();
118 118
                 $institutionGrade = Institution_class_grade::where('institution_class_id', '=', $institutionClass->id)->first();
119 119
                 $assignee_id = $institutionClass->staff_id ? $institutionClass->staff_id : $this->file['security_user_id'];
@@ -126,25 +126,25 @@  discard block
 block discarded – undo
126 126
                     'institution_class' => $institutionClass
127 127
                 ];
128 128
 
129
-                Institution_student_admission::createAdmission($studentInfo->id,$row,$params,$this->file);
130
-                Institution_student::createOrUpdate($studentInfo->id,$row,$params,$this->file);
131
-                $student = Institution_class_student::createOrUpdate($studentInfo->id,$params,$this->file);
132
-                User_special_need::createOrUpdate($student->student_id,$row,$this->file);
133
-                User_body_mass::createOrUpdate($student->student_id,$row,$this->file);
129
+                Institution_student_admission::createAdmission($studentInfo->id, $row, $params, $this->file);
130
+                Institution_student::createOrUpdate($studentInfo->id, $row, $params, $this->file);
131
+                $student = Institution_class_student::createOrUpdate($studentInfo->id, $params, $this->file);
132
+                User_special_need::createOrUpdate($student->student_id, $row, $this->file);
133
+                User_body_mass::createOrUpdate($student->student_id, $row, $this->file);
134 134
 
135
-                $this->createOrUpdateGuardian($row,$student,'father');
136
-                $this->createOrUpdateGuardian($row,$student,'mother');
137
-                $this->createOrUpdateGuardian($row,$student,'guardian');
135
+                $this->createOrUpdateGuardian($row, $student, 'father');
136
+                $this->createOrUpdateGuardian($row, $student, 'mother');
137
+                $this->createOrUpdateGuardian($row, $student, 'guardian');
138 138
                 
139 139
                 $studentInfo['student_id'] = $studentInfo->id;
140 140
                 Institution_student::updateStudentArea($studentInfo->toArray());
141 141
 
142
-                $this->insertOrUpdateSubjects($row,$student,$institution);
142
+                $this->insertOrUpdateSubjects($row, $student, $institution);
143 143
 
144 144
                 $totalStudents = Institution_class_student::getStudentsCount($this->file['institution_class_id']);
145 145
                 if ($totalStudents['total'] > $institutionClass->no_of_students) {
146 146
                     $error = \Illuminate\Validation\ValidationException::withMessages([]);
147
-                    $failure = new Failure(3, 'rows', [3 => 'Class student count exceeded! Max number of students is ' . $institutionClass->no_of_students], [null]);
147
+                    $failure = new Failure(3, 'rows', [3 => 'Class student count exceeded! Max number of students is '.$institutionClass->no_of_students], [null]);
148 148
                     $failures = [0 => $failure];
149 149
                     throw new \Maatwebsite\Excel\Validators\ValidationException($error, $failures);
150 150
                     Log::info('email-sent', [$this->file]);
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
                 $institutionClass = new Institution_class();
154 154
                 $institutionClass->updateClassCount($this->file);
155 155
             }
156
-        } catch (\Maatwebsite\Excel\Validators\ValidationException $e) {
156
+        }catch (\Maatwebsite\Excel\Validators\ValidationException $e) {
157 157
             $error = \Illuminate\Validation\ValidationException::withMessages([]);
158 158
             $failures = $e->failures();
159 159
             throw new \Maatwebsite\Excel\Validators\ValidationException($error, $failures);
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
             '*.full_name' => 'required|regex:/^[a-zA-Z .]*$/u|max:256',
169 169
             '*.preferred_name' => 'nullable|regex:/^[a-zA-Z .]*$/u|max:90',
170 170
             '*.gender_mf' => 'required|in:M,F',
171
-            '*.date_of_birth_yyyy_mm_dd' => 'date|required|admission_age:' . $this->file['institution_class_id'],
171
+            '*.date_of_birth_yyyy_mm_dd' => 'date|required|admission_age:'.$this->file['institution_class_id'],
172 172
             '*.address' => 'nullable',
173 173
             '*.birth_registrar_office_as_in_birth_certificate' => 'nullable|exists:area_administratives,name|required_if:identity_type,BC|birth_place',
174 174
             '*.birth_divisional_secretariat' => 'nullable|exists:area_administratives,name|required_with:birth_registrar_office_as_in_birth_certificate',
@@ -177,8 +177,8 @@  discard block
 block discarded – undo
177 177
             '*.identity_number' => 'nullable|identity:identity_type|required_with:*.identity_type',
178 178
             '*.education_grade' => 'required',
179 179
             '*.option_*' => 'nullable|exists:education_subjects,name',
180
-            '*.bmi_height' => 'bail|required_with:*.bmi_weight|bmi:' . $this->file['institution_class_id'],
181
-            '*.bmi_weight' => 'bail|required_with:*.bmi_height|bmi:' . $this->file['institution_class_id'],
180
+            '*.bmi_height' => 'bail|required_with:*.bmi_weight|bmi:'.$this->file['institution_class_id'],
181
+            '*.bmi_weight' => 'bail|required_with:*.bmi_height|bmi:'.$this->file['institution_class_id'],
182 182
             '*.bmi_date_yyyy_mm_dd' => 'bail|required_with:*.bmi_height|date', //bmi:'. $this->file['institution_class_id'].'
183 183
             '*.bmi_academic_period' => 'bail|required_with:*.bmi_height|exists:academic_periods,name',
184 184
             '*.admission_no' => 'required|max:12|min:4|regex:/^[A-Za-z0-9\/]+$/',
Please login to merge, or discard this patch.
app/Models/Institution_student.php 2 patches
Spacing   +34 added lines, -34 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
         });
@@ -129,9 +129,9 @@  discard block
 block discarded – undo
129 129
                 'institution_students.admission_id'
130 130
             )
131 131
             ->where('institution_students.institution_id', $institutionGrade['institution_id'])
132
-            ->where('institution_students.student_status_id',1)
132
+            ->where('institution_students.student_status_id', 1)
133 133
             ->where('institution_students.education_grade_id', $institutionGrade['education_grade_id'])
134
-            ->where('institution_students.deleted_at',null)
134
+            ->where('institution_students.deleted_at', null)
135 135
             ->where('institution_students.academic_period_id', $academicPeriod->id)->get()->toArray();
136 136
     }
137 137
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
      */
145 145
     public static function createExaminationData($student, $admissionInfo)
146 146
     {
147
-        $student['sp_center'] = gettype((int)$student['sp_center']) == 'integer' ?  $student['sp_center'] : 0;
147
+        $student['sp_center'] = gettype((int) $student['sp_center']) == 'integer' ? $student['sp_center'] : 0;
148 148
         try {
149 149
             self::create([
150 150
                 'id' => (string) Uuid::generate(4),
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
                 'created' => now(),
170 170
                 'created_user_id' => 1
171 171
             ]);
172
-        } catch (\Throwable $th) {
172
+        }catch (\Throwable $th) {
173 173
             Log::error($th);
174 174
         }
175 175
     }
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
      */
184 184
     public static function updateExaminationData($student, $admissionInfo)
185 185
     {
186
-        $student['sp_center'] = gettype((int)$student['sp_center']) == 'integer' ?  $student['sp_center'] : 0;
186
+        $student['sp_center'] = gettype((int) $student['sp_center']) == 'integer' ? $student['sp_center'] : 0;
187 187
         try {
188 188
             self::where([
189 189
                 'student_id' => $student['student_id'],
@@ -204,55 +204,55 @@  discard block
 block discarded – undo
204 204
                     'modified_user_id' => 1
205 205
                 ]
206 206
             );
207
-        } catch (\Throwable $th) {
207
+        }catch (\Throwable $th) {
208 208
             Log::error($th);
209 209
         }
210 210
     }
211 211
 
212
-    public static function updateStudentArea(array $student){
213
-        $father = Student_guardian::where('student_id',$student['student_id'])
214
-        ->join('security_users as sg','guardian_id', 'sg.id')
215
-        ->where('guardian_relation_id',1)
212
+    public static function updateStudentArea(array $student) {
213
+        $father = Student_guardian::where('student_id', $student['student_id'])
214
+        ->join('security_users as sg', 'guardian_id', 'sg.id')
215
+        ->where('guardian_relation_id', 1)
216 216
         ->get()->first();
217 217
 
218
-        $mother = Student_guardian::where('student_id',$student['student_id'])
219
-        ->join('security_users as sg','guardian_id', 'sg.id')
220
-        ->where('guardian_relation_id',2)
218
+        $mother = Student_guardian::where('student_id', $student['student_id'])
219
+        ->join('security_users as sg', 'guardian_id', 'sg.id')
220
+        ->where('guardian_relation_id', 2)
221 221
         ->get()->first();
222 222
 
223
-        $guardian = Student_guardian::where('student_id',$student['student_id'])
224
-        ->join('security_users as sg','guardian_id', 'sg.id')
225
-        ->where('guardian_relation_id',3)
223
+        $guardian = Student_guardian::where('student_id', $student['student_id'])
224
+        ->join('security_users as sg', 'guardian_id', 'sg.id')
225
+        ->where('guardian_relation_id', 3)
226 226
         ->get()->first();
227 227
     
228
-        if(!is_null($father) && is_null($mother) && is_null($guardian)){
229
-            Security_user::where('id',$student['student_id'])
228
+        if (!is_null($father) && is_null($mother) && is_null($guardian)) {
229
+            Security_user::where('id', $student['student_id'])
230 230
             ->update(['address_area_id' => $father->address_area_id]);
231
-        }elseif(!is_null($mother)  && (is_null($father) && is_null($guardian))){
232
-            Security_user::where('id',$student['student_id'])
231
+        }elseif (!is_null($mother) && (is_null($father) && is_null($guardian))) {
232
+            Security_user::where('id', $student['student_id'])
233 233
             ->update(['address_area_id' => $mother->address_area_id]);
234
-        }elseif(!is_null($guardian) && is_null($father) && is_null($mother)){
235
-            Security_user::where('id',$student['student_id'])
234
+        }elseif (!is_null($guardian) && is_null($father) && is_null($mother)) {
235
+            Security_user::where('id', $student['student_id'])
236 236
             ->update(['address_area_id' => $guardian->address_area_id]);
237
-        }elseif(!is_null($mother)  && !is_null($father) && ($father->address_area_id ==  $mother->address_area_id)){
238
-            Security_user::where('id',$student['student_id'])
237
+        }elseif (!is_null($mother) && !is_null($father) && ($father->address_area_id == $mother->address_area_id)) {
238
+            Security_user::where('id', $student['student_id'])
239 239
             ->update(['address_area_id' => $mother->address_area_id]);
240
-        }elseif(!is_null($mother)  && !is_null($father) && ($father->address_area_id !==  $mother->address_area_id) && !is_null($guardian)){
241
-            Security_user::where('id',$student['student_id'])
240
+        }elseif (!is_null($mother) && !is_null($father) && ($father->address_area_id !== $mother->address_area_id) && !is_null($guardian)) {
241
+            Security_user::where('id', $student['student_id'])
242 242
             ->update(['address_area_id' => $guardian->address_area_id]);
243
-        }elseif(!is_null($father) && $father->address == $student['address']){
244
-            Security_user::where('id',$student['student_id'])
243
+        }elseif (!is_null($father) && $father->address == $student['address']) {
244
+            Security_user::where('id', $student['student_id'])
245 245
             ->update(['address_area_id' => $father->address_area_id]);
246
-        }elseif(!is_null($mother) && $mother->address == $student['address']){
247
-            Security_user::where('id',$student['student_id'])
246
+        }elseif (!is_null($mother) && $mother->address == $student['address']) {
247
+            Security_user::where('id', $student['student_id'])
248 248
             ->update(['address_area_id' => $mother->address_area_id]);
249
-        }elseif(!is_null($guardian) && $guardian->address == $student['address']){
250
-            Security_user::where('id',$student['student_id'])
249
+        }elseif (!is_null($guardian) && $guardian->address == $student['address']) {
250
+            Security_user::where('id', $student['student_id'])
251 251
             ->update(['address_area_id' => $guardian->address_area_id]);
252 252
         }
253 253
     }
254 254
 
255
-    public static function createOrUpdate($studentId,$row,$params,$file){
255
+    public static function createOrUpdate($studentId, $row, $params, $file) {
256 256
         self::create([
257 257
             'student_status_id' => 1,
258 258
             'student_id' => $studentId,
Please login to merge, or discard this patch.
Braces   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -228,25 +228,25 @@
 block discarded – undo
228 228
         if(!is_null($father) && is_null($mother) && is_null($guardian)){
229 229
             Security_user::where('id',$student['student_id'])
230 230
             ->update(['address_area_id' => $father->address_area_id]);
231
-        }elseif(!is_null($mother)  && (is_null($father) && is_null($guardian))){
231
+        } elseif(!is_null($mother)  && (is_null($father) && is_null($guardian))){
232 232
             Security_user::where('id',$student['student_id'])
233 233
             ->update(['address_area_id' => $mother->address_area_id]);
234
-        }elseif(!is_null($guardian) && is_null($father) && is_null($mother)){
234
+        } elseif(!is_null($guardian) && is_null($father) && is_null($mother)){
235 235
             Security_user::where('id',$student['student_id'])
236 236
             ->update(['address_area_id' => $guardian->address_area_id]);
237
-        }elseif(!is_null($mother)  && !is_null($father) && ($father->address_area_id ==  $mother->address_area_id)){
237
+        } elseif(!is_null($mother)  && !is_null($father) && ($father->address_area_id ==  $mother->address_area_id)){
238 238
             Security_user::where('id',$student['student_id'])
239 239
             ->update(['address_area_id' => $mother->address_area_id]);
240
-        }elseif(!is_null($mother)  && !is_null($father) && ($father->address_area_id !==  $mother->address_area_id) && !is_null($guardian)){
240
+        } elseif(!is_null($mother)  && !is_null($father) && ($father->address_area_id !==  $mother->address_area_id) && !is_null($guardian)){
241 241
             Security_user::where('id',$student['student_id'])
242 242
             ->update(['address_area_id' => $guardian->address_area_id]);
243
-        }elseif(!is_null($father) && $father->address == $student['address']){
243
+        } elseif(!is_null($father) && $father->address == $student['address']){
244 244
             Security_user::where('id',$student['student_id'])
245 245
             ->update(['address_area_id' => $father->address_area_id]);
246
-        }elseif(!is_null($mother) && $mother->address == $student['address']){
246
+        } elseif(!is_null($mother) && $mother->address == $student['address']){
247 247
             Security_user::where('id',$student['student_id'])
248 248
             ->update(['address_area_id' => $mother->address_area_id]);
249
-        }elseif(!is_null($guardian) && $guardian->address == $student['address']){
249
+        } elseif(!is_null($guardian) && $guardian->address == $student['address']){
250 250
             Security_user::where('id',$student['student_id'])
251 251
             ->update(['address_area_id' => $guardian->address_area_id]);
252 252
         }
Please login to merge, or discard this patch.
app/Providers/ValidatorExtended.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -70,17 +70,17 @@  discard block
 block discarded – undo
70 70
             if (empty($value)) {
71 71
                 return false;
72 72
             } elseif ($gradeEntity !== null) {
73
-                $admissionAge = (($gradeEntity->admission_age) * 12) - 1;
73
+                $admissionAge = (($gradeEntity->admission_age)*12) - 1;
74 74
                 $to = $academicPeriod->start_date;
75 75
                 $diff_in_months = $to->diffInMonths($value);
76 76
                 $ageOfStudent = $diff_in_months;
77 77
                 $enrolmentMaximumAge = $admissionAge + 120;
78 78
                 return ($ageOfStudent <= $enrolmentMaximumAge) && ($ageOfStudent >= $admissionAge);
79
-            } else {
79
+            }else {
80 80
                 return false;
81 81
             }
82
-        } else {
83
-            $this->_custom_messages['admission_age'] = 'given' . $attribute . 'Not found';
82
+        }else {
83
+            $this->_custom_messages['admission_age'] = 'given'.$attribute.'Not found';
84 84
             $this->_set_custom_stuff();
85 85
             return false;
86 86
         }
@@ -91,16 +91,16 @@  discard block
 block discarded – undo
91 91
 
92 92
         if (is_numeric($value)) {
93 93
             if ($value < 10) {
94
-                $this->_custom_messages['bmi'] =  $attribute . ' is must greater than 10';
94
+                $this->_custom_messages['bmi'] = $attribute.' is must greater than 10';
95 95
                 $this->_set_custom_stuff();
96 96
                 return false;
97 97
             } elseif ($value > 250) {
98
-                $this->_custom_messages['bmi'] =  $attribute . ' is must smaller than 250';
98
+                $this->_custom_messages['bmi'] = $attribute.' is must smaller than 250';
99 99
                 $this->_set_custom_stuff();
100 100
                 return false;
101 101
             }
102
-        } else {
103
-            $this->_custom_messages['bmi'] =  $attribute . ' is must a valid numeric';
102
+        }else {
103
+            $this->_custom_messages['bmi'] = $attribute.' is must a valid numeric';
104 104
             $this->_set_custom_stuff();
105 105
             return false;
106 106
         }
@@ -109,18 +109,18 @@  discard block
 block discarded – undo
109 109
 
110 110
     protected function validateBmi($attribute, $value, $parameters)
111 111
     {
112
-        $bmiGrades =  ['G1', 'G4', 'G7', 'G10'];
112
+        $bmiGrades = ['G1', 'G4', 'G7', 'G10'];
113 113
         $institutionGrade = Institution_class_grade::where('institution_class_id', '=', $parameters[0])
114 114
             ->join('education_grades', 'institution_class_grades.education_grade_id', 'education_grades.id')
115 115
             ->first();
116
-        $educationGrade =  Education_grade::where('id', '=', $institutionGrade->education_grade_id)->first();
116
+        $educationGrade = Education_grade::where('id', '=', $institutionGrade->education_grade_id)->first();
117 117
         if (in_array($institutionGrade->code, $bmiGrades)) {
118 118
             if (!empty($value)) {
119 119
                 if (($attribute == 'bmi_height') || ('bmi_weight')) {
120 120
                     return $this->validateHW($attribute, $value);
121 121
                 }
122
-            } else {
123
-                $this->_custom_messages['bmi'] =  $attribute . ' is required for ' . $educationGrade->name;
122
+            }else {
123
+                $this->_custom_messages['bmi'] = $attribute.' is required for '.$educationGrade->name;
124 124
                 $this->_set_custom_stuff();
125 125
                 return false;
126 126
             }
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
             if (($attribute == 'bmi_height') || ('bmi_weight')) {
129 129
                 return $this->validateHW($attribute, $value);
130 130
             }
131
-        } else {
131
+        }else {
132 132
             return true;
133 133
         }
134 134
     }
@@ -137,19 +137,19 @@  discard block
 block discarded – undo
137 137
     {
138 138
         foreach ($validator->getData() as $data) {
139 139
             if ($data['identity_type'] == 'BC' && key_exists('birth_divisional_secretariat', $data)) {
140
-                $BirthDivision = Area_administrative::where('name', '=',  '%' . $data['birth_divisional_secretariat'] . '%')->where('area_administrative_level_id', '=', 5); //
140
+                $BirthDivision = Area_administrative::where('name', '=', '%'.$data['birth_divisional_secretariat'].'%')->where('area_administrative_level_id', '=', 5); //
141 141
                 if ($BirthDivision->count() > 0) {
142
-                    $BirthArea = Area_administrative::where('name', '=', '%' . $value . '%') //$data['birth_registrar_office_as_in_birth_certificate']
142
+                    $BirthArea = Area_administrative::where('name', '=', '%'.$value.'%') //$data['birth_registrar_office_as_in_birth_certificate']
143 143
                         ->where('parent_id', '=', $BirthDivision->first()->id)->count();
144
-                    return $BirthArea  > 0;
144
+                    return $BirthArea > 0;
145 145
                 } elseif (key_exists('birth_divisional_secretariat', $data) && (!key_exists('birth_registrar_office_as_in_birth_certificate', $data))) {
146 146
                     $this->_custom_messages['birth_place'] = 'birth_registrar_office_as_in_birth_certificate required with BC';
147 147
                     $this->_set_custom_stuff();
148 148
                     return false;
149
-                } else {
149
+                }else {
150 150
                     return true;
151 151
                 }
152
-            } else {
152
+            }else {
153 153
                 return true;
154 154
             }
155 155
         }
@@ -157,16 +157,16 @@  discard block
 block discarded – undo
157 157
 
158 158
     protected function validateIsStudentInClass($attribute, $value, $perameters, $validator)
159 159
     {
160
-        $student =  Security_user::where('openemis_no', '=', $value);
160
+        $student = Security_user::where('openemis_no', '=', $value);
161 161
         if ($student->count() > 0) {
162 162
             $student = $student->first()->toArray();
163
-            $check =  Institution_class_student::where('student_id', '=', $student['id'])->where('institution_class_id', '=', $perameters[0])->count();
163
+            $check = Institution_class_student::where('student_id', '=', $student['id'])->where('institution_class_id', '=', $perameters[0])->count();
164 164
             if ($check == 1) {
165 165
                 return true;
166
-            } else {
166
+            }else {
167 167
                 return false;
168 168
             }
169
-        } else {
169
+        }else {
170 170
             return false;
171 171
         }
172 172
     }
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
     {
178 178
         $valid = true;
179 179
         foreach ($validator->getData() as $data) {
180
-            switch($data[$perameters[0]]){
180
+            switch ($data[$perameters[0]]) {
181 181
                 case 'BC':
182 182
                     $valid = preg_match('/^([0-9]{3,5})/i', $value);
183 183
                     break;
@@ -190,10 +190,10 @@  discard block
 block discarded – undo
190 190
         }
191 191
         
192 192
         if ($valid == 0) {
193
-            $this->_custom_messages['identity'] = $attribute . ' is not valid  Please check the NIC number';
193
+            $this->_custom_messages['identity'] = $attribute.' is not valid  Please check the NIC number';
194 194
             $this->_set_custom_stuff();
195 195
             return false;
196
-        } else {
196
+        }else {
197 197
             return true;
198 198
         }
199 199
     }
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
     protected function validateUserUnique($attribute, $value, $perameters, $validator)
202 202
     {
203 203
         foreach ($validator->getData() as $data) {
204
-            $identityType = Identity_type::where('national_code', 'like', '%' . $data['identity_type'] . '%')->first();
204
+            $identityType = Identity_type::where('national_code', 'like', '%'.$data['identity_type'].'%')->first();
205 205
             if ($identityType !== null && ($value !== null)) {
206 206
                 if ($identityType->national_code === 'BC') {
207 207
                     return $this->checkUnique($value, $data, $identityType);
@@ -217,14 +217,14 @@  discard block
 block discarded – undo
217 217
     protected function validateIsBc($attribute, $value, $perameters, $validator)
218 218
     {
219 219
         foreach ($validator->getData() as $data) {
220
-            $identityType = Identity_type::where('national_code', 'like', '%' . $data['identity_type'] . '%')->first();
220
+            $identityType = Identity_type::where('national_code', 'like', '%'.$data['identity_type'].'%')->first();
221 221
             if (($identityType !== null) && ($identityType !== "")) {
222 222
                 if (($identityType->national_code) === 'BC') {
223 223
                     return (strlen((string) $data['identity_number']) < 7);
224
-                } else {
224
+                }else {
225 225
                     return true;
226 226
                 }
227
-            } else {
227
+            }else {
228 228
                 return true;
229 229
             }
230 230
         }
@@ -234,24 +234,24 @@  discard block
 block discarded – undo
234 234
     {
235 235
         $isUnique = Security_user::where('identity_number', '=', $value)->where('identity_type_id', '=', $identityType->id);
236 236
         if ($isUnique->count() > 0) {
237
-            $this->_custom_messages['user_unique'] = 'The identity number already in use. User ID is : ' . $isUnique->first()->openemis_no;
237
+            $this->_custom_messages['user_unique'] = 'The identity number already in use. User ID is : '.$isUnique->first()->openemis_no;
238 238
             $this->_set_custom_stuff();
239 239
             return false;
240
-        } else {
240
+        }else {
241 241
             return true;
242 242
         }
243 243
     }
244 244
 
245 245
     protected function IsBc($data, $value)
246 246
     {
247
-        $identityType = Identity_type::where('national_code', 'like', '%' . $data['identity_type'] . '%')->first();
247
+        $identityType = Identity_type::where('national_code', 'like', '%'.$data['identity_type'].'%')->first();
248 248
         if ($identityType !== null) {
249 249
             if (($identityType->national_code) === 'BC' && strlen((string) $value) < 8) {
250 250
                 return false;
251
-            } else {
251
+            }else {
252 252
                 return true;
253 253
             }
254
-        } else {
254
+        }else {
255 255
             return true;
256 256
         }
257 257
     }
Please login to merge, or discard this patch.
app/Console/Commands/ExaminationStudentSeed.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
         $output = new \Symfony\Component\Console\Output\ConsoleOutput();
42 42
         $output->writeln('###########################################------Inserting file records------###########################################');
43 43
        
44
-        ExaminationStudentsController::callOnClick($this->argument('year'),$this->argument('grade'));
44
+        ExaminationStudentsController::callOnClick($this->argument('year'), $this->argument('grade'));
45 45
         $output->writeln('###########################################------Finished inserting file records------###########################################');
46 46
     }
47 47
 }
Please login to merge, or discard this patch.
app/Console/Commands/ExaminationsUpdateCensusNo.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,9 +42,9 @@
 block discarded – undo
42 42
         $output = new \Symfony\Component\Console\Output\ConsoleOutput();
43 43
         $output->writeln('###########################################------Inserting file records------###########################################');
44 44
         $this->examinationController = new ExaminationStudentsController(2019, 'G4');
45
-        $students =  Examination_student::all()->toArray();
45
+        $students = Examination_student::all()->toArray();
46 46
         $func = $this->examinationController;
47
-        array_walk($students,array($func,'updateCensusNo'));
47
+        array_walk($students, array($func, 'updateCensusNo'));
48 48
 
49 49
                 
50 50
     }
Please login to merge, or discard this patch.
app/Http/Controllers/ExaminationStudentsController.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
         $this->grade = $grade;
31 31
         $this->student = new Security_user();
32 32
         $this->examination_student = new Examination_student();
33
-        $this->academic_period =  Academic_period::where('code', '=', $this->year)->first();
33
+        $this->academic_period = Academic_period::where('code', '=', $this->year)->first();
34 34
         $this->education_grade = Education_grade::where('code', '=', $this->grade)->first();
35 35
         $this->output = new \Symfony\Component\Console\Output\ConsoleOutput();
36 36
     }
@@ -72,10 +72,10 @@  discard block
 block discarded – undo
72 72
                     );
73 73
                     Session::flash('message', 'File upload successfully!');
74 74
                     // Redirect to index
75
-                } else {
75
+                }else {
76 76
                     Session::flash('message', 'File too large. File must be less than 20MB.');
77 77
                 }
78
-            } else {
78
+            }else {
79 79
                 Session::flash('message', 'Invalid File Extension.');
80 80
             }
81 81
         }
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
             $import->import($excelFile, 'local', \Maatwebsite\Excel\Excel::CSV);
98 98
             if ($import->failures()->count() > 0) {
99 99
                 $errors = $import->failures();
100
-                $columns =  [
100
+                $columns = [
101 101
                     'remarks',
102 102
                     'st_no',
103 103
                     'stu_no',
@@ -118,10 +118,10 @@  discard block
 block discarded – undo
118 118
                 Storage::put($file, implode(',', $columns));
119 119
 
120 120
                 foreach ($errors as $error) {
121
-                    Storage::append($file, implode(':', $error->errors()) . ',' . implode(',', $error->values()));
121
+                    Storage::append($file, implode(':', $error->errors()).','.implode(',', $error->values()));
122 122
                 }
123 123
             }
124
-        } catch (\Maatwebsite\Excel\Validators\ValidationException $e) {
124
+        }catch (\Maatwebsite\Excel\Validators\ValidationException $e) {
125 125
         }
126 126
     }
127 127
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
                 $Institution = $Institution[0];
145 145
                 if (count($student) == 1) {
146 146
                     $student = $student[0];
147
-                    if (((int)$Institution['id']) !=  ((int)$student['institution_id'])) {
147
+                    if (((int) $Institution['id']) != ((int) $student['institution_id'])) {
148 148
                         $studentClass = Institution_class_student::where('student_id', $student['student_id'])
149 149
                             ->first();
150 150
                         Institution_class_student::where('student_id', $student['student_id'])->delete();
@@ -154,12 +154,12 @@  discard block
 block discarded – undo
154 154
                         if (!is_null($studentClass)) {
155 155
                             $class->updateClassCount($studentClass->toArray());
156 156
                         }
157
-                        $output->writeln('updated student info:' . $data['nsid']);
157
+                        $output->writeln('updated student info:'.$data['nsid']);
158 158
                     }
159
-                } else {
159
+                }else {
160 160
                     Institution_student::where('institution_id', '<>', $Institution['id'])->where('student_id', $student[0]['student_id'])
161 161
                         ->delete();
162
-                    $output->writeln('updated student info:' . $Institution['id'] . '==' . $Institution['id']);
162
+                    $output->writeln('updated student info:'.$Institution['id'].'=='.$Institution['id']);
163 163
                 }
164 164
             }
165 165
         }
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
         $students = [];
176 176
         switch ($mode) {
177 177
             case 'duplicate':
178
-                $students =  DB::table('examination_students as es')
178
+                $students = DB::table('examination_students as es')
179 179
                     ->select(DB::raw('count(*) as total'), 'e2.*')
180 180
                     ->where('grade', $this->grade)
181 181
                     ->where('year', $this->year)
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
                     ->limit($limit)
188 188
                     ->get()->toArray();
189 189
                 $students = (array) json_decode(json_encode($students));
190
-                $this->output->writeln(count($students) . 'students remaining duplicate');
190
+                $this->output->writeln(count($students).'students remaining duplicate');
191 191
                 array_walk($students, array($this, 'clone'));
192 192
                 $this->output->writeln('All are generated');
193 193
                 break;
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
                     ->limit($limit)
201 201
                     ->get()->toArray();
202 202
                 $students = (array) json_decode(json_encode($students));
203
-                $this->output->writeln(count($students) . 'students remaining empty');
203
+                $this->output->writeln(count($students).'students remaining empty');
204 204
                 array_walk($students, array($this, 'clone'));
205 205
                 $this->output->writeln('All are generated');
206 206
                 break;
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
                     ->where('year', $this->year)
211 211
                     ->get()->toArray();
212 212
                 $students = (array) json_decode(json_encode($students));
213
-                $this->output->writeln(count($students) . 'students remaining with wrong NSID');
213
+                $this->output->writeln(count($students).'students remaining with wrong NSID');
214 214
                 array_walk($students, array($this, 'clone'));
215 215
                 $this->output->writeln('All are generated');
216 216
                 break;
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
                     ->count();
222 222
                 $all = Examination_student::select('nsid')
223 223
                     ->count();
224
-                $this->output->writeln($all . 'Total Unique nsid are: ' . $count);
224
+                $this->output->writeln($all.'Total Unique nsid are: '.$count);
225 225
                 break;
226 226
             default:
227 227
                 $students = Examination_student::offset($offset)
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
                     ->limit($limit)
231 231
                     ->get()->toArray();
232 232
                 $students = (array) json_decode(json_encode($students));
233
-                $this->output->writeln(count($students) . 'students remaining empty');
233
+                $this->output->writeln(count($students).'students remaining empty');
234 234
                 array_walk($students, array($this, 'clone'));
235 235
                 $this->output->writeln('All are generated');
236 236
         }
@@ -276,13 +276,13 @@  discard block
 block discarded – undo
276 276
      */
277 277
     public function clone($student)
278 278
     {
279
-        $student = (array)json_decode(json_encode($student));
279
+        $student = (array) json_decode(json_encode($student));
280 280
         //get student matching with same dob and gender
281 281
 
282 282
         $matchedStudent = $this->getMatchingStudents($student);
283 283
 
284 284
         // if the first match missing do complete insertion
285
-        $institution = Institution::where('code', '=', (int)$student['schoolid'])->first();
285
+        $institution = Institution::where('code', '=', (int) $student['schoolid'])->first();
286 286
 
287 287
         if (!is_null($institution)) {
288 288
 
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 
310 310
                 //TODO implement insert student to admission table
311 311
                 $student['id'] = $sis_student['id'];
312
-                $sis_student['student_id'] =  $student['id'];
312
+                $sis_student['student_id'] = $student['id'];
313 313
 
314 314
                 $student = $this->setIsTakingExam($student);
315 315
                 if (count($institutionClass) == 1) {
@@ -317,13 +317,13 @@  discard block
 block discarded – undo
317 317
                     Institution_student::createExaminationData($student, $admissionInfo);
318 318
                     Institution_student_admission::createExaminationData($student, $admissionInfo);
319 319
                     Institution_class_student::createExaminationData($student, $admissionInfo);
320
-                } else {
320
+                }else {
321 321
                     Institution_student_admission::createExaminationData($student, $admissionInfo);
322 322
                     Institution_student::createExaminationData($student, $admissionInfo);
323 323
                 }
324 324
                 $this->updateStudentId($student, $sis_student);
325 325
                 // update the matched student's data    
326
-            } else {
326
+            }else {
327 327
                 $student = $this->setIsTakingExam($student);
328 328
                 $studentData = $this->student->updateExaminationStudent($student, $matchedStudent);
329 329
                 $matchedStudent = array_merge((array) $student, $matchedStudent);
@@ -331,9 +331,9 @@  discard block
 block discarded – undo
331 331
                 Institution_student::updateExaminationData($studentData, $admissionInfo);
332 332
                 $this->updateStudentId($student, $studentData);
333 333
             }
334
-        } else {
334
+        }else {
335 335
 
336
-            $this->output->writeln('Student ' . $student['st_no'] . ' not imorted' . $student['f_name']);
336
+            $this->output->writeln('Student '.$student['st_no'].' not imorted'.$student['f_name']);
337 337
         }
338 338
     }
339 339
 
@@ -350,20 +350,20 @@  discard block
 block discarded – undo
350 350
         /**
351 351
          */
352 352
         $sis_student = $this->student->getMatches($student);
353
-        $doe_students =  Examination_student::where('gender', $student['gender'])
353
+        $doe_students = Examination_student::where('gender', $student['gender'])
354 354
             ->where('b_date', $student['b_date'])
355 355
             ->where('schoolid', $student['schoolid'])
356
-            ->where('year',$this->year)
357
-            ->where('grade',$this->grade)
356
+            ->where('year', $this->year)
357
+            ->where('grade', $this->grade)
358 358
             ->count();
359 359
         $count = $this->student->getStudentCount($student);
360 360
 
361 361
         $studentData = [];
362
-        $sis_users  = (array) json_decode(json_encode($sis_student), true);
362
+        $sis_users = (array) json_decode(json_encode($sis_student), true);
363 363
         // if the same gender same DOE has more than one 
364 364
         if (($doe_students > 1) || ($count > 1)) {
365 365
             $studentData = $this->searchSimilarName($student, $sis_users, false);
366
-        } else {
366
+        }else {
367 367
             $studentData = $this->searchSimilarName($student, $sis_users);
368 368
         }
369 369
         return $studentData;
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
         }
414 414
 
415 415
         if (count($matches) > 1) {
416
-            $highest =  $this->searchSimilarName($student, $sis_students, false);
416
+            $highest = $this->searchSimilarName($student, $sis_students, false);
417 417
         }
418 418
 
419 419
         return $highest;
@@ -429,18 +429,18 @@  discard block
 block discarded – undo
429 429
     public function updateStudentId($student, $sis_student)
430 430
     {
431 431
         try {
432
-            $student['nsid'] =  $sis_student['openemis_no'];
432
+            $student['nsid'] = $sis_student['openemis_no'];
433 433
             // add new NSID to the examinations data set
434 434
             unset($student['id']);
435 435
             unset($student['taking_g5_exam']);
436 436
             unset($student['taking_al_exam']);
437 437
             unset($student['taking_ol_exam']);
438 438
             unset($student['total']);
439
-            $students['updated_at'] =  now();
439
+            $students['updated_at'] = now();
440 440
             $this->examination_student->where('st_no', $student['st_no'])->update($student);
441 441
             unset($student['st_no']);
442
-            $this->output->writeln('Updated  to NSID' . $sis_student['openemis_no']);
443
-        } catch (\Exception $th) {
442
+            $this->output->writeln('Updated  to NSID'.$sis_student['openemis_no']);
443
+        }catch (\Exception $th) {
444 444
             dd($th);
445 445
             $this->output->writeln('error');
446 446
             Log::error($th);
@@ -456,9 +456,9 @@  discard block
 block discarded – undo
456 456
     {
457 457
         $adminUser = Security_user::where('username', 'admin')->first();
458 458
         try {
459
-            (new ExaminationStudentsExport($this->year,$this->grade))->store('examination/student_data_with_nsid.' . time() . '.csv');
459
+            (new ExaminationStudentsExport($this->year, $this->grade))->store('examination/student_data_with_nsid.'.time().'.csv');
460 460
             (new ExportReady($adminUser));
461
-        } catch (\Throwable $th) {
461
+        }catch (\Throwable $th) {
462 462
             //throw $th;
463 463
             dd($th);
464 464
         }
@@ -468,13 +468,13 @@  discard block
 block discarded – undo
468 468
     public function downloadErrors()
469 469
     {
470 470
 
471
-        $file_path = storage_path() . '/app/examination/errors.csv';
471
+        $file_path = storage_path().'/app/examination/errors.csv';
472 472
         return Response::download($file_path);
473 473
     }
474 474
 
475 475
     public function downloadProcessedFile()
476 476
     {
477
-        $file_path = storage_path() . '/app/examination/student_data_with_nsid.csv';
477
+        $file_path = storage_path().'/app/examination/student_data_with_nsid.csv';
478 478
         return Response::download($file_path);
479 479
     }
480 480
 }
Please login to merge, or discard this patch.