@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | break; |
193 | 193 | case 'empty'; |
194 | 194 | $students = Examination_student:: |
195 | - whereNull('nsid') |
|
195 | + whereNull('nsid') |
|
196 | 196 | ->where('grade', $this->grade) |
197 | 197 | ->where('year', $this->year) |
198 | 198 | ->offset($offset) |
@@ -323,13 +323,13 @@ discard block |
||
323 | 323 | $sis_student['student_id'] = $student['id' ]; |
324 | 324 | |
325 | 325 | $student = $this->setIsTakingExam($student); |
326 | - if (count($institutionClass) == 1) { |
|
326 | + if (count($institutionClass) == 1) { |
|
327 | 327 | $admissionInfo['instituion_class'] = $institutionClass[0]; |
328 | - Institution_student::createExaminationData($student, $admissionInfo); |
|
328 | + Institution_student::createExaminationData($student, $admissionInfo); |
|
329 | 329 | Institution_student_admission::createExaminationData($student, $admissionInfo); |
330 | 330 | Institution_class_student::createExaminationData($student, $admissionInfo); |
331 | 331 | } else { |
332 | - Institution_student_admission::createExaminationData($student, $admissionInfo); |
|
332 | + Institution_student_admission::createExaminationData($student, $admissionInfo); |
|
333 | 333 | Institution_student::createExaminationData($student, $admissionInfo); |
334 | 334 | } |
335 | 335 |
@@ -30,7 +30,7 @@ discard block |
||
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 | } |
@@ -71,10 +71,10 @@ discard block |
||
71 | 71 | ); |
72 | 72 | Session::flash('message', 'File upload successfully!'); |
73 | 73 | // Redirect to index |
74 | - } else { |
|
74 | + }else { |
|
75 | 75 | Session::flash('message', 'File too large. File must be less than 20MB.'); |
76 | 76 | } |
77 | - } else { |
|
77 | + }else { |
|
78 | 78 | Session::flash('message', 'Invalid File Extension.'); |
79 | 79 | } |
80 | 80 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $import->import($excelFile, 'local', \Maatwebsite\Excel\Excel::CSV); |
97 | 97 | if ($import->failures()->count() > 0) { |
98 | 98 | $errors = $import->failures(); |
99 | - $columns = [ |
|
99 | + $columns = [ |
|
100 | 100 | 'remarks', |
101 | 101 | 'st_no', |
102 | 102 | 'stu_no', |
@@ -117,10 +117,10 @@ discard block |
||
117 | 117 | Storage::put($file, implode(',', $columns)); |
118 | 118 | |
119 | 119 | foreach ($errors as $error) { |
120 | - Storage::append($file, implode(':', $error->errors()) . ',' . implode(',', $error->values())); |
|
120 | + Storage::append($file, implode(':', $error->errors()).','.implode(',', $error->values())); |
|
121 | 121 | } |
122 | 122 | } |
123 | - } catch (\Maatwebsite\Excel\Validators\ValidationException $e) { |
|
123 | + }catch (\Maatwebsite\Excel\Validators\ValidationException $e) { |
|
124 | 124 | } |
125 | 125 | } |
126 | 126 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | $Institution = $Institution[0]; |
144 | 144 | if (count($student) == 1) { |
145 | 145 | $student = $student[0]; |
146 | - if (((int)$Institution['id']) != ((int)$student['institution_id'])) { |
|
146 | + if (((int) $Institution['id']) != ((int) $student['institution_id'])) { |
|
147 | 147 | $studentClass = Institution_class_student::where('student_id', $student['student_id']) |
148 | 148 | ->first(); |
149 | 149 | Institution_class_student::where('student_id', $student['student_id'])->delete(); |
@@ -153,12 +153,12 @@ discard block |
||
153 | 153 | if (!is_null($studentClass)) { |
154 | 154 | $class->updateClassCount($studentClass->toArray()); |
155 | 155 | } |
156 | - $output->writeln('updated student info:' . $data['nsid']); |
|
156 | + $output->writeln('updated student info:'.$data['nsid']); |
|
157 | 157 | } |
158 | - } else { |
|
158 | + }else { |
|
159 | 159 | Institution_student::where('institution_id', '<>', $Institution['id'])->where('student_id', $student[0]['student_id']) |
160 | 160 | ->delete(); |
161 | - $output->writeln('updated student info:' . $Institution['id'] . '==' . $Institution['id']); |
|
161 | + $output->writeln('updated student info:'.$Institution['id'].'=='.$Institution['id']); |
|
162 | 162 | } |
163 | 163 | } |
164 | 164 | } |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | $students = []; |
175 | 175 | switch ($mode) { |
176 | 176 | case 'duplicate': |
177 | - $students = DB::table('examination_students as es') |
|
177 | + $students = DB::table('examination_students as es') |
|
178 | 178 | ->select(DB::raw('count(*) as total'), 'e2.*') |
179 | 179 | ->where('grade', $this->grade) |
180 | 180 | ->where('year', $this->year) |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | ->limit($limit) |
187 | 187 | ->get()->toArray(); |
188 | 188 | $students = (array) json_decode(json_encode($students)); |
189 | - $this->output->writeln(count($students) . 'students remaining duplicate'); |
|
189 | + $this->output->writeln(count($students).'students remaining duplicate'); |
|
190 | 190 | array_walk($students, array($this, 'clone')); |
191 | 191 | $this->output->writeln('All are generated'); |
192 | 192 | break; |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | ->limit($limit) |
200 | 200 | ->get()->toArray(); |
201 | 201 | $students = (array) json_decode(json_encode($students)); |
202 | - $this->output->writeln(count($students) . 'students remaining empty'); |
|
202 | + $this->output->writeln(count($students).'students remaining empty'); |
|
203 | 203 | array_walk($students, array($this, 'clone')); |
204 | 204 | $this->output->writeln('All are generated'); |
205 | 205 | break; |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | ->where('year', $this->year) |
210 | 210 | ->get()->toArray(); |
211 | 211 | $students = (array) json_decode(json_encode($students)); |
212 | - $this->output->writeln(count($students) . 'students remaining with wrong NSID'); |
|
212 | + $this->output->writeln(count($students).'students remaining with wrong NSID'); |
|
213 | 213 | array_walk($students, array($this, 'clone')); |
214 | 214 | $this->output->writeln('All are generated'); |
215 | 215 | break; |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | ->count(); |
221 | 221 | $all = Examination_student::select('nsid') |
222 | 222 | ->count(); |
223 | - $this->output->writeln($all . 'Total Unique nsid are: ' . $count); |
|
223 | + $this->output->writeln($all.'Total Unique nsid are: '.$count); |
|
224 | 224 | break; |
225 | 225 | default: |
226 | 226 | $students = Examination_student::offset($offset) |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | ->limit($limit) |
230 | 230 | ->get()->toArray(); |
231 | 231 | $students = (array) json_decode(json_encode($students)); |
232 | - $this->output->writeln(count($students) . 'students remaining empty'); |
|
232 | + $this->output->writeln(count($students).'students remaining empty'); |
|
233 | 233 | array_walk($students, array($this, 'clone')); |
234 | 234 | $this->output->writeln('All are generated'); |
235 | 235 | } |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | */ |
278 | 278 | public function clone($student) |
279 | 279 | { |
280 | - $student = (array)json_decode(json_encode($student)); |
|
280 | + $student = (array) json_decode(json_encode($student)); |
|
281 | 281 | //get student matching with same dob and gender |
282 | 282 | |
283 | 283 | $matchedStudent = $this->getMatchingStudents($student); |
@@ -296,13 +296,13 @@ discard block |
||
296 | 296 | 'academic_period_id' => $this->academic_period->id |
297 | 297 | ] |
298 | 298 | ) |
299 | - ->where( 'education_grade_id','in', [$this->student->education_garde_id]) |
|
299 | + ->where('education_grade_id', 'in', [$this->student->education_garde_id]) |
|
300 | 300 | ->join('institution_class_grades', 'institution_classes.id', 'institution_class_grades.institution_class_id')->get()->toArray(); |
301 | 301 | |
302 | 302 | |
303 | - if(!is_null($this->student->education_garde_id)){ |
|
303 | + if (!is_null($this->student->education_garde_id)) { |
|
304 | 304 | $this->education_grade = Education_grade::where('id', '=', $this->student->education_garde_id)->first(); |
305 | - }else{ |
|
305 | + }else { |
|
306 | 306 | $this->student->education_garde_id = $this->education_grade->id; |
307 | 307 | } |
308 | 308 | |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | |
321 | 321 | //TODO implement insert student to admission table |
322 | 322 | $student['id'] = $sis_student['id']; |
323 | - $sis_student['student_id'] = $student['id' ]; |
|
323 | + $sis_student['student_id'] = $student['id']; |
|
324 | 324 | |
325 | 325 | $student = $this->setIsTakingExam($student); |
326 | 326 | if (count($institutionClass) == 1) { |
@@ -328,14 +328,14 @@ discard block |
||
328 | 328 | Institution_student::createExaminationData($student, $admissionInfo); |
329 | 329 | Institution_student_admission::createExaminationData($student, $admissionInfo); |
330 | 330 | Institution_class_student::createExaminationData($student, $admissionInfo); |
331 | - } else { |
|
331 | + }else { |
|
332 | 332 | Institution_student_admission::createExaminationData($student, $admissionInfo); |
333 | 333 | Institution_student::createExaminationData($student, $admissionInfo); |
334 | 334 | } |
335 | 335 | |
336 | 336 | $this->updateStudentId($student, $sis_student); |
337 | 337 | // update the matched student's data |
338 | - } else { |
|
338 | + }else { |
|
339 | 339 | $student = $this->setIsTakingExam($student); |
340 | 340 | $studentData = $this->student->updateExaminationStudent($student, $matchedStudent); |
341 | 341 | $matchedStudent = array_merge((array) $student, $matchedStudent); |
@@ -343,9 +343,9 @@ discard block |
||
343 | 343 | Institution_student::updateExaminationData($studentData, $admissionInfo); |
344 | 344 | $this->updateStudentId($student, $studentData); |
345 | 345 | } |
346 | - } else { |
|
346 | + }else { |
|
347 | 347 | |
348 | - $this->output->writeln('Student ' . $student['st_no'] . ' not imorted' . $student['f_name']); |
|
348 | + $this->output->writeln('Student '.$student['st_no'].' not imorted'.$student['f_name']); |
|
349 | 349 | } |
350 | 350 | } |
351 | 351 | |
@@ -362,20 +362,20 @@ discard block |
||
362 | 362 | /** |
363 | 363 | */ |
364 | 364 | $sis_student = $this->student->getMatches($student); |
365 | - $doe_students = Examination_student::where('gender', $student['gender']) |
|
365 | + $doe_students = Examination_student::where('gender', $student['gender']) |
|
366 | 366 | ->where('b_date', $student['b_date']) |
367 | 367 | ->where('schoolid', $student['schoolid']) |
368 | - ->where('year',$this->year) |
|
369 | - ->where('grade',$this->grade) |
|
368 | + ->where('year', $this->year) |
|
369 | + ->where('grade', $this->grade) |
|
370 | 370 | ->count(); |
371 | 371 | $count = $this->student->getStudentCount($student); |
372 | 372 | |
373 | 373 | $studentData = []; |
374 | - $sis_users = (array) json_decode(json_encode($sis_student), true); |
|
374 | + $sis_users = (array) json_decode(json_encode($sis_student), true); |
|
375 | 375 | // if the same gender same DOE has more than one |
376 | 376 | if (($doe_students > 1) || ($count > 1)) { |
377 | 377 | $studentData = $this->searchSimilarName($student, $sis_users, false); |
378 | - } else { |
|
378 | + }else { |
|
379 | 379 | $studentData = $this->searchSimilarName($student, $sis_users); |
380 | 380 | } |
381 | 381 | return $studentData; |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | } |
426 | 426 | |
427 | 427 | if (count($matches) > 1) { |
428 | - $highest = $this->searchSimilarName($student, $sis_students, false); |
|
428 | + $highest = $this->searchSimilarName($student, $sis_students, false); |
|
429 | 429 | } |
430 | 430 | |
431 | 431 | return $highest; |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | public function updateStudentId($student, $sis_student) |
442 | 442 | { |
443 | 443 | try { |
444 | - $student['nsid'] = $sis_student['openemis_no']; |
|
444 | + $student['nsid'] = $sis_student['openemis_no']; |
|
445 | 445 | // add new NSID to the examinations data set |
446 | 446 | unset($student['id']); |
447 | 447 | unset($student['taking_g5_exam']); |
@@ -449,11 +449,11 @@ discard block |
||
449 | 449 | unset($student['taking_ol_exam']); |
450 | 450 | unset($student['taking_git_exam']); |
451 | 451 | unset($student['total']); |
452 | - $students['updated_at'] = now(); |
|
452 | + $students['updated_at'] = now(); |
|
453 | 453 | $this->examination_student->where('st_no', $student['st_no'])->update($student); |
454 | 454 | unset($student['st_no']); |
455 | - $this->output->writeln('Updated to NSID' . $sis_student['openemis_no']); |
|
456 | - } catch (\Exception $th) { |
|
455 | + $this->output->writeln('Updated to NSID'.$sis_student['openemis_no']); |
|
456 | + }catch (\Exception $th) { |
|
457 | 457 | $this->output->writeln('error'); |
458 | 458 | Log::error($th); |
459 | 459 | } |
@@ -468,9 +468,9 @@ discard block |
||
468 | 468 | { |
469 | 469 | $adminUser = Security_user::where('username', 'admin')->first(); |
470 | 470 | try { |
471 | - (new ExaminationStudentsExport($this->year,$this->grade))->store('examination/student_data_with_nsid.' . time() . '.csv'); |
|
471 | + (new ExaminationStudentsExport($this->year, $this->grade))->store('examination/student_data_with_nsid.'.time().'.csv'); |
|
472 | 472 | (new ExportReady($adminUser)); |
473 | - } catch (\Throwable $th) { |
|
473 | + }catch (\Throwable $th) { |
|
474 | 474 | //throw $th; |
475 | 475 | } |
476 | 476 | return back()->withSuccess('Export started!'); |
@@ -479,14 +479,14 @@ discard block |
||
479 | 479 | public function downloadErrors() |
480 | 480 | { |
481 | 481 | |
482 | - $file_path = storage_path() . '/app/examination/errors.csv'; |
|
482 | + $file_path = storage_path().'/app/examination/errors.csv'; |
|
483 | 483 | return Response::download($file_path); |
484 | 484 | } |
485 | 485 | |
486 | 486 | public function downloadProcessedFile() |
487 | 487 | { |
488 | 488 | |
489 | - $file_path = storage_path() . '/app/examination/student_data_with_nsid.1628499466.csv'; //hard coded file name |
|
489 | + $file_path = storage_path().'/app/examination/student_data_with_nsid.1628499466.csv'; //hard coded file name |
|
490 | 490 | return Response::download($file_path); |
491 | 491 | } |
492 | 492 | } |
@@ -302,7 +302,7 @@ |
||
302 | 302 | |
303 | 303 | if(!is_null($this->student->education_garde_id)){ |
304 | 304 | $this->education_grade = Education_grade::where('id', '=', $this->student->education_garde_id)->first(); |
305 | - }else{ |
|
305 | + } else{ |
|
306 | 306 | $this->student->education_garde_id = $this->education_grade->id; |
307 | 307 | } |
308 | 308 |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | $studentData['id'] = $id; |
205 | 205 | $this->uniqueUserId->updateOrInsertRecord($studentData); |
206 | 206 | return $studentData; |
207 | - } catch (\Exception $th) { |
|
207 | + }catch (\Exception $th) { |
|
208 | 208 | Log::error($th->getMessage()); |
209 | 209 | // in case of duplication of the Unique ID this will recursive till success. |
210 | 210 | $sis_student['openemis_no'] = $this->uniqueUId::getUniqueAlphanumeric(); |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | $this->uniqueUserId = new Unique_user_id(); |
226 | 226 | $this->uniqueUId = new UniqueUid(); |
227 | 227 | // regenerate unique id if it's not available |
228 | - $uniqueId = ($this->uniqueUId::isValidUniqueId($sis_student['openemis_no'], 9)) ? $sis_student['openemis_no'] : $this->uniqueUId::getUniqueAlphanumeric(); |
|
228 | + $uniqueId = ($this->uniqueUId::isValidUniqueId($sis_student['openemis_no'], 9)) ? $sis_student['openemis_no'] : $this->uniqueUId::getUniqueAlphanumeric(); |
|
229 | 229 | |
230 | 230 | $studentData = [ |
231 | 231 | 'username' => str_replace('-', '', $uniqueId), |
@@ -243,11 +243,11 @@ discard block |
||
243 | 243 | $studentData['id'] = $sis_student['student_id']; |
244 | 244 | $this->uniqueUserId->updateOrInsertRecord($studentData); |
245 | 245 | return $studentData; |
246 | - } catch (\Exception $th) { |
|
246 | + }catch (\Exception $th) { |
|
247 | 247 | Log::error($th); |
248 | 248 | // in case of duplication of the Unique ID this will recursive. |
249 | 249 | $sis_student['openemis_no'] = $this->uniqueUId::getUniqueAlphanumeric(); |
250 | - $this->updateExaminationStudent($student,$sis_student); |
|
250 | + $this->updateExaminationStudent($student, $sis_student); |
|
251 | 251 | } |
252 | 252 | } |
253 | 253 | |
@@ -255,9 +255,9 @@ discard block |
||
255 | 255 | { |
256 | 256 | try { |
257 | 257 | $uniqueUid = new UniqueUid(); |
258 | - $BirthArea = Area_administrative::where('name', 'like', '%' . $row['birth_registrar_office_as_in_birth_certificate'] . '%')->first(); |
|
259 | - $nationalityId = Nationality::where('name', 'like', '%' . $row['nationality'] . '%')->first(); |
|
260 | - $identityType = Identity_type::where('national_code', 'like', '%' . $row['identity_type'] . '%')->first(); |
|
258 | + $BirthArea = Area_administrative::where('name', 'like', '%'.$row['birth_registrar_office_as_in_birth_certificate'].'%')->first(); |
|
259 | + $nationalityId = Nationality::where('name', 'like', '%'.$row['nationality'].'%')->first(); |
|
260 | + $identityType = Identity_type::where('national_code', 'like', '%'.$row['identity_type'].'%')->first(); |
|
261 | 261 | |
262 | 262 | $date = $row['date_of_birth_yyyy_mm_dd']; |
263 | 263 | $identityType = $identityType !== null ? $identityType->id : null; |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | ]); |
290 | 290 | case 'update': |
291 | 291 | if (!is_null($row['student_id'])) { |
292 | - $studentInfo = Security_user::where('openemis_no',trim($row['student_id']))->first(); |
|
292 | + $studentInfo = Security_user::where('openemis_no', trim($row['student_id']))->first(); |
|
293 | 293 | self::query()->where('openemis_no', $row['student_id']) |
294 | 294 | ->update([ |
295 | 295 | 'first_name' => $row['full_name'] ? $row['full_name'] : $studentInfo['first_name'], // here we save full name in the column of first name. re reduce breaks of the system. |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | } |
311 | 311 | break; |
312 | 312 | } |
313 | - } catch (\Exception $e) { |
|
313 | + }catch (\Exception $e) { |
|
314 | 314 | dd($e); |
315 | 315 | } |
316 | 316 | } |
@@ -319,48 +319,48 @@ discard block |
||
319 | 319 | { |
320 | 320 | try { |
321 | 321 | $uniqueUid = new UniqueUid(); |
322 | - $AddressArea = Area_administrative::where('name', 'like', '%' . $row[$prefix . 's_address_area'] . '%')->first(); |
|
323 | - $nationalityId = Nationality::where('name', 'like', '%' . $row[$prefix . 's_nationality'] . '%')->first(); |
|
324 | - $identityType = Identity_type::where('national_code', 'like', '%' . $row[$prefix . 's_identity_type'] . '%')->first(); |
|
322 | + $AddressArea = Area_administrative::where('name', 'like', '%'.$row[$prefix.'s_address_area'].'%')->first(); |
|
323 | + $nationalityId = Nationality::where('name', 'like', '%'.$row[$prefix.'s_nationality'].'%')->first(); |
|
324 | + $identityType = Identity_type::where('national_code', 'like', '%'.$row[$prefix.'s_identity_type'].'%')->first(); |
|
325 | 325 | $openemisNo = $uniqueUid::getUniqueAlphanumeric(); |
326 | 326 | |
327 | 327 | $identityType = ($identityType !== null) ? $identityType->id : null; |
328 | 328 | $nationalityId = $nationalityId !== null ? $nationalityId->id : null; |
329 | 329 | |
330 | 330 | $guardian = null; |
331 | - if (!empty($row[$prefix . 's_identity_number'])) { |
|
331 | + if (!empty($row[$prefix.'s_identity_number'])) { |
|
332 | 332 | $guardian = Security_user::where('identity_type_id', '=', $nationalityId) |
333 | - ->where('identity_number', '=', $row[$prefix . 's_identity_number'])->first(); |
|
333 | + ->where('identity_number', '=', $row[$prefix.'s_identity_number'])->first(); |
|
334 | 334 | } |
335 | 335 | |
336 | 336 | if (is_null($guardian)) { |
337 | 337 | $guardian = self::create([ |
338 | 338 | 'username' => str_replace('-', '', $openemisNo), |
339 | 339 | 'openemis_no' => $openemisNo, |
340 | - 'first_name' => $row[$prefix . 's_full_name'], // here we save full name in the column of first name. re reduce breaks of the system. |
|
341 | - 'last_name' => genNameWithInitials($row[$prefix . 's_full_name']), |
|
340 | + 'first_name' => $row[$prefix.'s_full_name'], // here we save full name in the column of first name. re reduce breaks of the system. |
|
341 | + 'last_name' => genNameWithInitials($row[$prefix.'s_full_name']), |
|
342 | 342 | 'gender_id' => 1, |
343 | - 'date_of_birth' => $row[$prefix . 's_date_of_birth_yyyy_mm_dd'], |
|
344 | - 'address' => $row[$prefix . 's_address'], |
|
343 | + 'date_of_birth' => $row[$prefix.'s_date_of_birth_yyyy_mm_dd'], |
|
344 | + 'address' => $row[$prefix.'s_address'], |
|
345 | 345 | 'address_area_id' => $AddressArea ? $AddressArea->id : null, |
346 | 346 | 'nationality_id' => $nationalityId, |
347 | 347 | 'identity_type_id' => $identityType, |
348 | - 'identity_number' => $row[$prefix . 's_identity_number'], |
|
348 | + 'identity_number' => $row[$prefix.'s_identity_number'], |
|
349 | 349 | 'is_guardian' => 1, |
350 | 350 | 'created_user_id' => $file['security_user_id'] |
351 | 351 | ]); |
352 | 352 | |
353 | 353 | |
354 | 354 | $guardian['guardian_relation_id'] = 1; |
355 | - if (array_key_exists($prefix . 's_phone', $row)) { |
|
356 | - $father['contact'] = $row[$prefix . 's_phone']; |
|
355 | + if (array_key_exists($prefix.'s_phone', $row)) { |
|
356 | + $father['contact'] = $row[$prefix.'s_phone']; |
|
357 | 357 | User_contact::createOrUpdate($father, $file['security_user_id']); |
358 | 358 | } |
359 | - } else { |
|
360 | - Security_user::where('id', $guardian->id)->update(['address_area_id' => $AddressArea ? $AddressArea->id : null,]); |
|
359 | + }else { |
|
360 | + Security_user::where('id', $guardian->id)->update(['address_area_id' => $AddressArea ? $AddressArea->id : null, ]); |
|
361 | 361 | } |
362 | 362 | return $guardian; |
363 | - } catch (\Exception $e) { |
|
363 | + }catch (\Exception $e) { |
|
364 | 364 | Log::error($e->getMessage(), [$e]); |
365 | 365 | } |
366 | 366 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | */ |
84 | 84 | public function model(array $row) |
85 | 85 | { |
86 | - try { |
|
86 | + try { |
|
87 | 87 | $insertData = array( |
88 | 88 | 'st_no' => $row['st_no'], |
89 | 89 | 'stu_no' => $row['stu_no'], |
@@ -102,9 +102,9 @@ discard block |
||
102 | 102 | "sp_center" => $row['sp_center'] |
103 | 103 | ); |
104 | 104 | Examination_student::insertData($insertData); |
105 | - } catch (\Throwable $th) { |
|
105 | + } catch (\Throwable $th) { |
|
106 | 106 | // dd($row); |
107 | - } |
|
107 | + } |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | public function rules(): array |
@@ -18,11 +18,11 @@ discard block |
||
18 | 18 | use Maatwebsite\Excel\Concerns\WithBatchInserts; |
19 | 19 | use Maatwebsite\Excel\Concerns\WithChunkReading; |
20 | 20 | |
21 | -class ExaminationStudentsImport implements ToModel, WithStartRow, WithHeadingRow, WithChunkReading, WithBatchInserts , WithValidation ,WithMapping, SkipsOnFailure, SkipsOnError |
|
21 | +class ExaminationStudentsImport implements ToModel, WithStartRow, WithHeadingRow, WithChunkReading, WithBatchInserts, WithValidation, WithMapping, SkipsOnFailure, SkipsOnError |
|
22 | 22 | { |
23 | - use Importable , SkipsFailures, SkipsErrors; |
|
23 | + use Importable, SkipsFailures, SkipsErrors; |
|
24 | 24 | |
25 | - public function __construct($year,$grade) |
|
25 | + public function __construct($year, $grade) |
|
26 | 26 | { |
27 | 27 | $this->year = $year; |
28 | 28 | $this->grade = $grade; |
@@ -62,14 +62,14 @@ discard block |
||
62 | 62 | |
63 | 63 | private function transformDateTime(string $value, string $format = 'm/d/Y') |
64 | 64 | { |
65 | - try{ |
|
65 | + try { |
|
66 | 66 | $date = date_create_from_format('m/d/Y', $value); |
67 | - if(gettype($date)=='boolean'){ |
|
67 | + if (gettype($date) == 'boolean') { |
|
68 | 68 | $date = date_create_from_format('Y-m-d', $value); |
69 | 69 | } |
70 | 70 | $date = date_format($date, 'Y-m-d'); |
71 | 71 | return $date; |
72 | - }catch(\Exception $e){ |
|
72 | + }catch (\Exception $e) { |
|
73 | 73 | $error = \Illuminate\Validation\ValidationException::withMessages([]); |
74 | 74 | $failure = new Failure(2, 'remark', [0 => 'The given date is wrong']); |
75 | 75 | $failures = [0 => $failure]; |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | "medium" => $row['medium'], |
92 | 92 | "gender" => $row['gender'], |
93 | 93 | "b_date" => $row['b_date'], |
94 | - "a_income" => $row['a_income'] ? $row['a_income'] : 0 , |
|
94 | + "a_income" => $row['a_income'] ? $row['a_income'] : 0, |
|
95 | 95 | "grade" => $this->grade, |
96 | 96 | 'year' => $this->year, |
97 | 97 | "schoolid" => $row['schoolid'], |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | "sp_center" => $row['sp_center'] |
103 | 103 | ); |
104 | 104 | Examination_student::insertData($insertData); |
105 | - } catch (\Throwable $th) { |
|
105 | + }catch (\Throwable $th) { |
|
106 | 106 | // dd($row); |
107 | 107 | } |
108 | 108 | } |
@@ -65,21 +65,21 @@ |
||
65 | 65 | */ |
66 | 66 | if (!empty($institution_grades)) { |
67 | 67 | |
68 | - $this->info('Fetched ' . count($institution_grades) . ' records'); |
|
68 | + $this->info('Fetched '.count($institution_grades).' records'); |
|
69 | 69 | |
70 | 70 | foreach ($institution_grades as $institute_grade) { |
71 | 71 | if ($institute_grade->promoted == "2019") { |
72 | 72 | $this->info('Promoted year have already set to 2019'); |
73 | - } else { |
|
73 | + }else { |
|
74 | 74 | $this->info('Updating record ======================================='); |
75 | 75 | DB::update("update institution_grades set promoted ='2019' where institution_id = ?", [$this->argument('institution')]); |
76 | 76 | $this->info('Record updated ========================================'); |
77 | 77 | } |
78 | 78 | } |
79 | - } else { |
|
79 | + }else { |
|
80 | 80 | $this->info('No results!'); |
81 | 81 | } |
82 | - } catch (\Exception $e) { |
|
82 | + }catch (\Exception $e) { |
|
83 | 83 | return $e->getMessage(); |
84 | 84 | } |
85 | 85 | } |
@@ -84,32 +84,32 @@ |
||
84 | 84 | try{ |
85 | 85 | $output->writeln($approvedstudent['student_id']."Updated"); |
86 | 86 | Institution_student::create([ |
87 | - 'student_status_id' => 1, |
|
88 | - 'student_id' => $approvedstudent['student_id'], |
|
89 | - 'education_grade_id' => $approvedstudent['education_grade_id'], |
|
90 | - 'academic_period_id' => $approvedstudent['academic_period_id'], |
|
91 | - 'start_date' => $approvedstudent['start_date'], |
|
92 | - 'start_year' => \Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $approvedstudent['start_date'])->year , // $approvedstudent['start_date']->format('Y'), |
|
93 | - 'end_date' => $approvedstudent['end_date'], |
|
94 | - 'end_year' => \Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $approvedstudent['end_date'])->year , //$approvedstudent['end_date']->format('Y'), |
|
95 | - 'institution_id' => $approvedstudent['institution_id'], |
|
96 | - 'admission_id' => $approvedstudent['admission_id'], |
|
97 | - 'created_user_id' => $approvedstudent['created_user_id'], |
|
98 | - ]); |
|
99 | - if(!is_null($approvedstudent['institution_class_id'])){ |
|
100 | - Institution_class_student::create([ |
|
101 | - 'student_id' => $approvedstudent['student_id'], |
|
102 | - 'institution_class_id' => $approvedstudent['institution_class_id'], |
|
103 | - 'education_grade_id' => $approvedstudent['education_grade_id'], |
|
104 | - 'academic_period_id' => $approvedstudent['academic_period_id'], |
|
105 | - 'institution_id' =>$approvedstudent['institution_id'], |
|
106 | - 'student_status_id' => 1, |
|
107 | - 'created_user_id' => $approvedstudent['created_user_id'], |
|
108 | - ]); |
|
109 | - } |
|
110 | - }catch (\Exception $e){ |
|
111 | - echo $e->getMessage(); |
|
112 | - } |
|
87 | + 'student_status_id' => 1, |
|
88 | + 'student_id' => $approvedstudent['student_id'], |
|
89 | + 'education_grade_id' => $approvedstudent['education_grade_id'], |
|
90 | + 'academic_period_id' => $approvedstudent['academic_period_id'], |
|
91 | + 'start_date' => $approvedstudent['start_date'], |
|
92 | + 'start_year' => \Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $approvedstudent['start_date'])->year , // $approvedstudent['start_date']->format('Y'), |
|
93 | + 'end_date' => $approvedstudent['end_date'], |
|
94 | + 'end_year' => \Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $approvedstudent['end_date'])->year , //$approvedstudent['end_date']->format('Y'), |
|
95 | + 'institution_id' => $approvedstudent['institution_id'], |
|
96 | + 'admission_id' => $approvedstudent['admission_id'], |
|
97 | + 'created_user_id' => $approvedstudent['created_user_id'], |
|
98 | + ]); |
|
99 | + if(!is_null($approvedstudent['institution_class_id'])){ |
|
100 | + Institution_class_student::create([ |
|
101 | + 'student_id' => $approvedstudent['student_id'], |
|
102 | + 'institution_class_id' => $approvedstudent['institution_class_id'], |
|
103 | + 'education_grade_id' => $approvedstudent['education_grade_id'], |
|
104 | + 'academic_period_id' => $approvedstudent['academic_period_id'], |
|
105 | + 'institution_id' =>$approvedstudent['institution_id'], |
|
106 | + 'student_status_id' => 1, |
|
107 | + 'created_user_id' => $approvedstudent['created_user_id'], |
|
108 | + ]); |
|
109 | + } |
|
110 | + }catch (\Exception $e){ |
|
111 | + echo $e->getMessage(); |
|
112 | + } |
|
113 | 113 | } |
114 | 114 | $output->writeln(' |
115 | 115 | #################################################### |
@@ -50,14 +50,14 @@ discard block |
||
50 | 50 | 'id' => $this->argument('institution') |
51 | 51 | ])->first(); |
52 | 52 | |
53 | - if(!is_null($institution)){ |
|
53 | + if (!is_null($institution)) { |
|
54 | 54 | DB::enableQueryLog(); |
55 | 55 | try { |
56 | - $this->info('adding missing students to the institution ' . $institution->name); |
|
56 | + $this->info('adding missing students to the institution '.$institution->name); |
|
57 | 57 | $approvedstudent = Institution_student_admission::select('institution_student_admission.*') |
58 | 58 | ->leftJoin('institution_students', 'institution_student_admission.student_id', '=', 'institution_students.student_id') |
59 | - ->whereIn('status_id',[121,122,123,124]) |
|
60 | - ->where('institution_student_admission.institution_id',$institution->id)->get()->toArray(); |
|
59 | + ->whereIn('status_id', [121, 122, 123, 124]) |
|
60 | + ->where('institution_student_admission.institution_id', $institution->id)->get()->toArray(); |
|
61 | 61 | |
62 | 62 | $approvedstudent = array_chunk($approvedstudent, 50); |
63 | 63 | |
@@ -69,19 +69,19 @@ discard block |
||
69 | 69 | } |
70 | 70 | } |
71 | 71 | |
72 | - protected function addStudents($approvedstudent){ |
|
73 | - array_walk($approvedstudent,array($this,'addStudent')); |
|
72 | + protected function addStudents($approvedstudent) { |
|
73 | + array_walk($approvedstudent, array($this, 'addStudent')); |
|
74 | 74 | } |
75 | 75 | |
76 | - protected function addStudent($approvedstudent){ |
|
76 | + protected function addStudent($approvedstudent) { |
|
77 | 77 | $output = new \Symfony\Component\Console\Output\ConsoleOutput(); |
78 | 78 | Log::info($approvedstudent); |
79 | 79 | // sleep(1); |
80 | - if((Institution_student::isDuplicated($approvedstudent) == 0)){ |
|
80 | + if ((Institution_student::isDuplicated($approvedstudent) == 0)) { |
|
81 | 81 | dd($approvedstudent); |
82 | 82 | $this->count += 1; |
83 | - $this->student = $approvedstudent ; |
|
84 | - try{ |
|
83 | + $this->student = $approvedstudent; |
|
84 | + try { |
|
85 | 85 | $output->writeln($approvedstudent['student_id']."Updated"); |
86 | 86 | Institution_student::create([ |
87 | 87 | 'student_status_id' => 1, |
@@ -89,14 +89,14 @@ discard block |
||
89 | 89 | 'education_grade_id' => $approvedstudent['education_grade_id'], |
90 | 90 | 'academic_period_id' => $approvedstudent['academic_period_id'], |
91 | 91 | 'start_date' => $approvedstudent['start_date'], |
92 | - 'start_year' => \Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $approvedstudent['start_date'])->year , // $approvedstudent['start_date']->format('Y'), |
|
92 | + 'start_year' => \Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $approvedstudent['start_date'])->year, // $approvedstudent['start_date']->format('Y'), |
|
93 | 93 | 'end_date' => $approvedstudent['end_date'], |
94 | - 'end_year' => \Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $approvedstudent['end_date'])->year , //$approvedstudent['end_date']->format('Y'), |
|
94 | + 'end_year' => \Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $approvedstudent['end_date'])->year, //$approvedstudent['end_date']->format('Y'), |
|
95 | 95 | 'institution_id' => $approvedstudent['institution_id'], |
96 | 96 | 'admission_id' => $approvedstudent['admission_id'], |
97 | 97 | 'created_user_id' => $approvedstudent['created_user_id'], |
98 | 98 | ]); |
99 | - if(!is_null($approvedstudent['institution_class_id'])){ |
|
99 | + if (!is_null($approvedstudent['institution_class_id'])) { |
|
100 | 100 | Institution_class_student::create([ |
101 | 101 | 'student_id' => $approvedstudent['student_id'], |
102 | 102 | 'institution_class_id' => $approvedstudent['institution_class_id'], |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | 'created_user_id' => $approvedstudent['created_user_id'], |
108 | 108 | ]); |
109 | 109 | } |
110 | - }catch (\Exception $e){ |
|
110 | + }catch (\Exception $e) { |
|
111 | 111 | echo $e->getMessage(); |
112 | 112 | } |
113 | 113 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | |
64 | 64 | array_walk($approvedstudent, array($this, 'addStudents')); |
65 | 65 | |
66 | - }catch (\Exception $e) { |
|
66 | + } catch (\Exception $e) { |
|
67 | 67 | Log::error($e); |
68 | 68 | } |
69 | 69 | } |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | 'created_user_id' => $approvedstudent['created_user_id'], |
108 | 108 | ]); |
109 | 109 | } |
110 | - }catch (\Exception $e){ |
|
110 | + } catch (\Exception $e){ |
|
111 | 111 | echo $e->getMessage(); |
112 | 112 | } |
113 | 113 | } |