@@ -58,9 +58,9 @@ discard block |
||
58 | 58 | use App\Imports\StudentUpdate; |
59 | 59 | use Maatwebsite\Excel\Exceptions\ConcernConflictException; |
60 | 60 | |
61 | -class UsersImport extends Import Implements ToModel, WithStartRow, WithHeadingRow, WithMultipleSheets, WithEvents, WithMapping, WithLimit, WithBatchInserts, WithValidation ,SkipsOnFailure ,SkipsOnError { |
|
61 | +class UsersImport extends Import Implements ToModel, WithStartRow, WithHeadingRow, WithMultipleSheets, WithEvents, WithMapping, WithLimit, WithBatchInserts, WithValidation, SkipsOnFailure, SkipsOnError { |
|
62 | 62 | |
63 | - use Importable, SkipsFailures , SkipsErrors; |
|
63 | + use Importable, SkipsFailures, SkipsErrors; |
|
64 | 64 | |
65 | 65 | |
66 | 66 | public function sheets(): array { |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | throw new \Maatwebsite\Excel\Validators\ValidationException($error, $failures); |
85 | 85 | } |
86 | 86 | }, |
87 | - BeforeImport::class => function (BeforeImport $event) { |
|
87 | + BeforeImport::class => function(BeforeImport $event) { |
|
88 | 88 | $this->highestRow = ($event->getReader()->getDelegate()->getActiveSheet()->getHighestDataRow('C')); |
89 | 89 | if ($this->highestRow < 3) { |
90 | 90 | $error = \Illuminate\Validation\ValidationException::withMessages([]); |
@@ -120,9 +120,9 @@ discard block |
||
120 | 120 | break; |
121 | 121 | } |
122 | 122 | |
123 | - $BirthArea = Area_administrative::where('name', 'like', '%' . $row['birth_registrar_office_as_in_birth_certificate'] . '%')->first(); |
|
124 | - $nationalityId = Nationality::where('name', 'like', '%' . $row['nationality'] . '%')->first(); |
|
125 | - $identityType = Identity_type::where('national_code', 'like', '%' . $row['identity_type'] . '%')->first(); |
|
123 | + $BirthArea = Area_administrative::where('name', 'like', '%'.$row['birth_registrar_office_as_in_birth_certificate'].'%')->first(); |
|
124 | + $nationalityId = Nationality::where('name', 'like', '%'.$row['nationality'].'%')->first(); |
|
125 | + $identityType = Identity_type::where('national_code', 'like', '%'.$row['identity_type'].'%')->first(); |
|
126 | 126 | $academicPeriod = Academic_period::where('name', '=', $row['academic_period'])->first(); |
127 | 127 | |
128 | 128 | |
@@ -138,8 +138,8 @@ discard block |
||
138 | 138 | |
139 | 139 | $openemisStudent = $this->uniqueUid::getUniqueAlphanumeric(); |
140 | 140 | \Log::debug('Security_user'); |
141 | - $student = Security_user::create([ |
|
142 | - 'username' => str_replace('-','',$openemisStudent), |
|
141 | + $student = Security_user::create([ |
|
142 | + 'username' => str_replace('-', '', $openemisStudent), |
|
143 | 143 | 'openemis_no' => $openemisStudent, |
144 | 144 | 'first_name' => $row['full_name'], // here we save full name in the column of first name. re reduce breaks of the system. |
145 | 145 | 'last_name' => genNameWithInitials($row['full_name']), |
@@ -232,12 +232,12 @@ discard block |
||
232 | 232 | } |
233 | 233 | |
234 | 234 | |
235 | - if(!empty($row['bmi_weight']) && !empty($row['bmi_weight']) && !empty($row['bmi_date_yyyy_mm_dd'])){ |
|
235 | + if (!empty($row['bmi_weight']) && !empty($row['bmi_weight']) && !empty($row['bmi_date_yyyy_mm_dd'])) { |
|
236 | 236 | // convert Meeter to CM |
237 | - $hight = $row['bmi_height'] / 100; |
|
237 | + $hight = $row['bmi_height']/100; |
|
238 | 238 | |
239 | 239 | //calculate BMI |
240 | - $bodyMass = ($row['bmi_weight']) / pow($hight, 2); |
|
240 | + $bodyMass = ($row['bmi_weight'])/pow($hight, 2); |
|
241 | 241 | |
242 | 242 | $bmiAcademic = Academic_period::where('name', '=', $row['bmi_academic_period'])->first(); |
243 | 243 | |
@@ -256,9 +256,9 @@ discard block |
||
256 | 256 | |
257 | 257 | if (!empty($row['fathers_full_name']) && ($row['fathers_date_of_birth_yyyy_mm_dd'] !== null)) { |
258 | 258 | |
259 | - $AddressArea = Area_administrative::where('name', 'like', '%' . $row['fathers_address_area'] . '%')->first(); |
|
260 | - $nationalityId = Nationality::where('name', 'like', '%' . $row['fathers_nationality'] . '%')->first(); |
|
261 | - $identityType = Identity_type::where('national_code', 'like', '%' . $row['fathers_identity_type'] . '%')->first(); |
|
259 | + $AddressArea = Area_administrative::where('name', 'like', '%'.$row['fathers_address_area'].'%')->first(); |
|
260 | + $nationalityId = Nationality::where('name', 'like', '%'.$row['fathers_nationality'].'%')->first(); |
|
261 | + $identityType = Identity_type::where('national_code', 'like', '%'.$row['fathers_identity_type'].'%')->first(); |
|
262 | 262 | $openemisFather = $this->uniqueUid::getUniqueAlphanumeric(); |
263 | 263 | |
264 | 264 | $identityType = ($identityType !== null) ? $identityType->id : null; |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | if ($father === null) { |
275 | 275 | |
276 | 276 | $father = Security_user::create([ |
277 | - 'username' => str_replace('-','',$openemisFather), |
|
277 | + 'username' => str_replace('-', '', $openemisFather), |
|
278 | 278 | 'openemis_no' => $openemisFather, |
279 | 279 | 'first_name' => $row['fathers_full_name'], // here we save full name in the column of first name. re reduce breaks of the system. |
280 | 280 | 'last_name' => genNameWithInitials($row['fathers_full_name']), |
@@ -293,25 +293,25 @@ discard block |
||
293 | 293 | $father['guardian_relation_id'] = 1; |
294 | 294 | if (array_key_exists('fathers_phone', $row)) { |
295 | 295 | $father['contact'] = $row['fathers_phone']; |
296 | - User_contact::createOrUpdate($father,$this->file['security_user_id']); |
|
296 | + User_contact::createOrUpdate($father, $this->file['security_user_id']); |
|
297 | 297 | } |
298 | 298 | Student_guardian::createStudentGuardian($student, $father, $this->file['security_user_id']); |
299 | - } else { |
|
299 | + }else { |
|
300 | 300 | Security_user::where('id', '=', $father->id) |
301 | 301 | ->update(['is_guardian' => 1]); |
302 | 302 | $father['guardian_relation_id'] = 1; |
303 | 303 | if (array_key_exists('fathers_phone', $row)) { |
304 | 304 | $father['contact'] = $row['fathers_phone']; |
305 | - User_contact::createOrUpdate($father,$this->file['security_user_id']); |
|
305 | + User_contact::createOrUpdate($father, $this->file['security_user_id']); |
|
306 | 306 | } |
307 | 307 | Student_guardian::createStudentGuardian($student, $father, $this->file['security_user_id']); |
308 | 308 | } |
309 | 309 | } |
310 | 310 | |
311 | 311 | if (!empty($row['mothers_full_name']) && ($row['mothers_date_of_birth_yyyy_mm_dd'] !== null)) { |
312 | - $AddressArea = Area_administrative::where('name', 'like', '%' . $row['mothers_address_area'] . '%')->first(); |
|
313 | - $nationalityId = Nationality::where('name', 'like', '%' . $row['mothers_nationality'] . '%')->first(); |
|
314 | - $identityType = Identity_type::where('national_code', 'like', '%' . $row['mothers_identity_type'] . '%')->first(); |
|
312 | + $AddressArea = Area_administrative::where('name', 'like', '%'.$row['mothers_address_area'].'%')->first(); |
|
313 | + $nationalityId = Nationality::where('name', 'like', '%'.$row['mothers_nationality'].'%')->first(); |
|
314 | + $identityType = Identity_type::where('national_code', 'like', '%'.$row['mothers_identity_type'].'%')->first(); |
|
315 | 315 | $openemisMother = $this->uniqueUid::getUniqueAlphanumeric(); |
316 | 316 | |
317 | 317 | $identityType = $identityType !== null ? $identityType->id : null; |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | |
327 | 327 | if ($mother === null) { |
328 | 328 | $mother = Security_user::create([ |
329 | - 'username' => str_replace('-','',$openemisMother), |
|
329 | + 'username' => str_replace('-', '', $openemisMother), |
|
330 | 330 | 'openemis_no' => $openemisMother, |
331 | 331 | 'first_name' => $row['mothers_full_name'], // here we save full name in the column of first name. re reduce breaks of the system. |
332 | 332 | 'last_name' => genNameWithInitials($row['mothers_full_name']), |
@@ -353,16 +353,16 @@ discard block |
||
353 | 353 | $mother['guardian_relation_id'] = 2; |
354 | 354 | if (array_key_exists('mothers_phone', $row)) { |
355 | 355 | $mother['contact'] = $row['mothers_phone']; |
356 | - User_contact::createOrUpdate($mother,$this->file['security_user_id']); |
|
356 | + User_contact::createOrUpdate($mother, $this->file['security_user_id']); |
|
357 | 357 | } |
358 | 358 | Student_guardian::createStudentGuardian($student, $mother, $this->file['security_user_id']); |
359 | - } else { |
|
359 | + }else { |
|
360 | 360 | Security_user::where('id', '=', $mother->id) |
361 | 361 | ->update(['is_guardian' => 1]); |
362 | 362 | $mother['guardian_relation_id'] = 2; |
363 | 363 | if (array_key_exists('mothers_phone', $row)) { |
364 | 364 | $mother['contact'] = $row['mothers_phone']; |
365 | - User_contact::createOrUpdate($mother,$this->file['security_user_id']); |
|
365 | + User_contact::createOrUpdate($mother, $this->file['security_user_id']); |
|
366 | 366 | } |
367 | 367 | Student_guardian::createStudentGuardian($student, $mother, $this->file['security_user_id']); |
368 | 368 | } |
@@ -371,9 +371,9 @@ discard block |
||
371 | 371 | |
372 | 372 | if (!empty($row['guardians_full_name']) && ($row['guardians_date_of_birth_yyyy_mm_dd'] !== null)) { |
373 | 373 | $genderId = $row['guardians_gender_mf'] == 'M' ? 1 : 2; |
374 | - $AddressArea = Area_administrative::where('name', 'like', '%' . $row['guardians_address_area'] . '%')->first(); |
|
375 | - $nationalityId = Nationality::where('name', 'like', '%' . $row['guardians_nationality'] . '%')->first(); |
|
376 | - $identityType = Identity_type::where('national_code', 'like', '%' . $row['guardians_identity_type'] . '%')->first(); |
|
374 | + $AddressArea = Area_administrative::where('name', 'like', '%'.$row['guardians_address_area'].'%')->first(); |
|
375 | + $nationalityId = Nationality::where('name', 'like', '%'.$row['guardians_nationality'].'%')->first(); |
|
376 | + $identityType = Identity_type::where('national_code', 'like', '%'.$row['guardians_identity_type'].'%')->first(); |
|
377 | 377 | $openemisGuardian = $this->uniqueUid::getUniqueAlphanumeric(); |
378 | 378 | |
379 | 379 | $identityType = $identityType !== null ? $identityType->id : null; |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | |
389 | 389 | if ($guardian === null) { |
390 | 390 | $guardian = Security_user::create([ |
391 | - 'username' => str_replace('-','',$openemisGuardian), |
|
391 | + 'username' => str_replace('-', '', $openemisGuardian), |
|
392 | 392 | 'openemis_no' => $openemisGuardian, |
393 | 393 | 'first_name' => $row['guardians_full_name'], // here we save full name in the column of first name. re reduce breaks of the system. |
394 | 394 | 'last_name' => genNameWithInitials($row['guardians_full_name']), |
@@ -415,16 +415,16 @@ discard block |
||
415 | 415 | $guardian['guardian_relation_id'] = 3; |
416 | 416 | if (array_key_exists('guardians_phone', $row)) { |
417 | 417 | $guardian['contact'] = $row['guardians_phone']; |
418 | - User_contact::createOrUpdate($guardian,$this->file['security_user_id']); |
|
418 | + User_contact::createOrUpdate($guardian, $this->file['security_user_id']); |
|
419 | 419 | } |
420 | 420 | Student_guardian::createStudentGuardian($student, $guardian, $this->file['security_user_id']); |
421 | - } else { |
|
421 | + }else { |
|
422 | 422 | Security_user::where('id', '=', $guardian->id) |
423 | 423 | ->update(['is_guardian' => 1]); |
424 | 424 | $guardian['guardian_relation_id'] = 3; |
425 | 425 | if (array_key_exists('guardians_phone', $row)) { |
426 | 426 | $guardian['contact'] = $row['guardians_phone']; |
427 | - User_contact::createOrUpdate($guardian,$this->file['security_user_id']); |
|
427 | + User_contact::createOrUpdate($guardian, $this->file['security_user_id']); |
|
428 | 428 | } |
429 | 429 | Student_guardian::createStudentGuardian($student, $guardian, $this->file['security_user_id']); |
430 | 430 | } |
@@ -437,12 +437,12 @@ discard block |
||
437 | 437 | if (!empty($allSubjects)) { |
438 | 438 | $allSubjects = unique_multidim_array($allSubjects, 'institution_subject_id'); |
439 | 439 | $this->student = $student; |
440 | - $allSubjects = array_map(array($this,'setStudentSubjects'),$allSubjects); |
|
440 | + $allSubjects = array_map(array($this, 'setStudentSubjects'), $allSubjects); |
|
441 | 441 | // $allSubjects = array_unique($allSubjects,SORT_REGULAR); |
442 | 442 | // $allSubjects = unique_multidim_array($allSubjects, 'education_subject_id'); |
443 | 443 | // array_walk($allSubjects,array($this,'insertSubject')); |
444 | 444 | $allSubjects = unique_multidim_array($allSubjects, 'education_subject_id'); |
445 | - array_walk($allSubjects,array($this,'insertSubject')); |
|
445 | + array_walk($allSubjects, array($this, 'insertSubject')); |
|
446 | 446 | // Institution_subject_student::insert((array) $allSubjects); |
447 | 447 | } |
448 | 448 | |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | |
453 | 453 | if ($totalStudents['total'] > $institutionClass->no_of_students) { |
454 | 454 | $error = \Illuminate\Validation\ValidationException::withMessages([]); |
455 | - $failure = new Failure(3, 'rows', [3 => 'Class student count exceeded! Max number of students is ' . $institutionClass->no_of_students], [null]); |
|
455 | + $failure = new Failure(3, 'rows', [3 => 'Class student count exceeded! Max number of students is '.$institutionClass->no_of_students], [null]); |
|
456 | 456 | $failures = [0 => $failure]; |
457 | 457 | throw new \Maatwebsite\Excel\Validators\ValidationException($error, $failures); |
458 | 458 | Log::info('email-sent', [$this->file]); |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | 'total_male_students' => $totalStudents['total_male_students'], |
464 | 464 | 'total_female_students' => $totalStudents['total_female_students']]); |
465 | 465 | } |
466 | - } catch (\Maatwebsite\Excel\Validators\ValidationException $e) { |
|
466 | + }catch (\Maatwebsite\Excel\Validators\ValidationException $e) { |
|
467 | 467 | $error = \Illuminate\Validation\ValidationException::withMessages([]); |
468 | 468 | // $failure = new Failure(3, 'remark', [3 => ], [null]); |
469 | 469 | $failures = $e->failures(); |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | return [ |
478 | 478 | '*.full_name' => 'required|regex:/^[\pL\s\-]+$/u|max:100', |
479 | 479 | '*.gender_mf' => 'required|in:M,F', |
480 | - '*.date_of_birth_yyyy_mm_dd' => 'date|required|admission_age:' . $this->file['institution_class_id'], |
|
480 | + '*.date_of_birth_yyyy_mm_dd' => 'date|required|admission_age:'.$this->file['institution_class_id'], |
|
481 | 481 | '*.address' => 'nullable', |
482 | 482 | '*.birth_registrar_office_as_in_birth_certificate' => 'nullable|exists:area_administratives,name|required_if:identity_type,BC|birth_place', |
483 | 483 | '*.birth_divisional_secretariat' => 'nullable|exists:area_administratives,name|required_with:birth_registrar_office_as_in_birth_certificate', |
@@ -487,14 +487,14 @@ discard block |
||
487 | 487 | '*.academic_period' => 'required|exists:academic_periods,name', |
488 | 488 | '*.education_grade' => 'required', |
489 | 489 | '*.option_*' => 'nullable|exists:education_subjects,name', |
490 | - '*.bmi_height' => 'bail|bmi:'. $this->file['institution_class_id'], |
|
491 | - '*.bmi_weight' => 'bail|bmi:'. $this->file['institution_class_id'], |
|
492 | - '*.bmi_date_yyyy_mm_dd' => 'bail|bmi:'. $this->file['institution_class_id'].'date', |
|
493 | - '*.bmi_academic_period' => 'bail|bmi:'. $this->file['institution_class_id'].'exists:academic_periods,name', |
|
490 | + '*.bmi_height' => 'bail|bmi:'.$this->file['institution_class_id'], |
|
491 | + '*.bmi_weight' => 'bail|bmi:'.$this->file['institution_class_id'], |
|
492 | + '*.bmi_date_yyyy_mm_dd' => 'bail|bmi:'.$this->file['institution_class_id'].'date', |
|
493 | + '*.bmi_academic_period' => 'bail|bmi:'.$this->file['institution_class_id'].'exists:academic_periods,name', |
|
494 | 494 | '*.admission_no' => 'required|max:12|min:1', |
495 | 495 | '*.start_date_yyyy_mm_dd' => 'required', |
496 | 496 | '*.special_need_type' => 'nullable', |
497 | - '*.special_need' => 'nullable|exists:special_need_difficulties,name|required_if:special_need_type,Differantly Able',//|exists:special_need_difficulties,name', |
|
497 | + '*.special_need' => 'nullable|exists:special_need_difficulties,name|required_if:special_need_type,Differantly Able', //|exists:special_need_difficulties,name', |
|
498 | 498 | '*.fathers_full_name' => 'nullable|regex:/^[\pL\s\-]+$/u', |
499 | 499 | '*.fathers_date_of_birth_yyyy_mm_dd' => 'required_with:fathers_full_name', |
500 | 500 | '*.fathers_address' => 'required_with:fathers_full_name', |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | use Maatwebsite\Excel\Concerns\WithMultipleSheets; |
55 | 55 | use Maatwebsite\Excel\Concerns\RegistersEventListeners; |
56 | 56 | |
57 | -class StudentUpdate extends Import implements ToModel, WithStartRow, WithHeadingRow, WithMultipleSheets, WithEvents, WithMapping, WithLimit, WithBatchInserts, WithValidation , SkipsOnFailure , SkipsOnError{ |
|
57 | +class StudentUpdate extends Import implements ToModel, WithStartRow, WithHeadingRow, WithMultipleSheets, WithEvents, WithMapping, WithLimit, WithBatchInserts, WithValidation, SkipsOnFailure, SkipsOnError{ |
|
58 | 58 | |
59 | 59 | use Importable, |
60 | 60 | RegistersEventListeners, |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $worksheet = $event->getSheet(); |
80 | 80 | $this->highestRow = $worksheet->getHighestDataRow('B'); |
81 | 81 | }, |
82 | - BeforeImport::class => function (BeforeImport $event) { |
|
82 | + BeforeImport::class => function(BeforeImport $event) { |
|
83 | 83 | $event->getReader()->getDelegate()->setActiveSheetIndex(2); |
84 | 84 | $this->highestRow = ($event->getReader()->getDelegate()->getActiveSheet()->getHighestDataRow('B')); |
85 | 85 | if ($this->highestRow < 3) { |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | $mandatorySubject = Institution_class_subject::getMandetorySubjects($this->file['institution_class_id']); |
109 | 109 | $subjects = getMatchingKeys($row); |
110 | 110 | $genderId = null; |
111 | - if($row['gender_mf'] !== null){ |
|
111 | + if ($row['gender_mf'] !== null) { |
|
112 | 112 | $genderId = $row['gender_mf'] == 'M' ? 1 : 2; |
113 | 113 | } |
114 | 114 | switch ($row['gender_mf']) { |
@@ -120,9 +120,9 @@ discard block |
||
120 | 120 | break; |
121 | 121 | } |
122 | 122 | |
123 | - $BirthArea = Area_administrative::where('name', 'like', '%' . $row['birth_registrar_office_as_in_birth_certificate'] . '%')->first(); |
|
124 | - $nationalityId = Nationality::where('name', 'like', '%' . $row['nationality'] . '%')->first(); |
|
125 | - $identityType = Identity_type::where('national_code', 'like', '%' . $row['identity_type'] . '%')->first(); |
|
123 | + $BirthArea = Area_administrative::where('name', 'like', '%'.$row['birth_registrar_office_as_in_birth_certificate'].'%')->first(); |
|
124 | + $nationalityId = Nationality::where('name', 'like', '%'.$row['nationality'].'%')->first(); |
|
125 | + $identityType = Identity_type::where('national_code', 'like', '%'.$row['identity_type'].'%')->first(); |
|
126 | 126 | $academicPeriod = Academic_period::where('name', '=', $row['academic_period'])->first(); |
127 | 127 | |
128 | 128 | |
@@ -191,17 +191,17 @@ discard block |
||
191 | 191 | if (!empty($row['bmi_height']) && (!empty($row['bmi_weight']))) { |
192 | 192 | |
193 | 193 | // convert Meeter to CM |
194 | - $hight = $row['bmi_height'] / 100; |
|
194 | + $hight = $row['bmi_height']/100; |
|
195 | 195 | |
196 | 196 | //calculate BMI |
197 | - $bodyMass = ($row['bmi_weight']) / pow($hight, 2); |
|
197 | + $bodyMass = ($row['bmi_weight'])/pow($hight, 2); |
|
198 | 198 | |
199 | 199 | $bmiAcademic = Academic_period::where('name', '=', $row['bmi_academic_period'])->first(); |
200 | - $count = User_body_mass::where('academic_period_id' ,'=',$bmiAcademic->id ) |
|
201 | - ->where('security_user_id','=',$student->student_id)->count(); |
|
200 | + $count = User_body_mass::where('academic_period_id', '=', $bmiAcademic->id) |
|
201 | + ->where('security_user_id', '=', $student->student_id)->count(); |
|
202 | 202 | |
203 | 203 | \Log::debug('User_body_mass'); |
204 | - if(!($count > 0)){ |
|
204 | + if (!($count > 0)) { |
|
205 | 205 | User_body_mass::create([ |
206 | 206 | 'height' => $row['bmi_height'], |
207 | 207 | 'weight' => $row['bmi_weight'], |
@@ -215,10 +215,10 @@ discard block |
||
215 | 215 | } |
216 | 216 | |
217 | 217 | if (!empty($row['fathers_full_name']) && ($row['fathers_date_of_birth_yyyy_mm_dd'] !== null)) { |
218 | - $AddressArea = Area_administrative::where('name', 'like', '%' . $row['fathers_address_area'] . '%')->first(); |
|
219 | - $nationalityId = Nationality::where('name', 'like', '%' . $row['fathers_nationality'] . '%')->first(); |
|
220 | - $identityType = Identity_type::where('national_code', 'like', '%' . $row['fathers_identity_type'] . '%')->first(); |
|
221 | - $openemisFather = $this->uniqueUid::getUniqueAlphanumeric(); |
|
218 | + $AddressArea = Area_administrative::where('name', 'like', '%'.$row['fathers_address_area'].'%')->first(); |
|
219 | + $nationalityId = Nationality::where('name', 'like', '%'.$row['fathers_nationality'].'%')->first(); |
|
220 | + $identityType = Identity_type::where('national_code', 'like', '%'.$row['fathers_identity_type'].'%')->first(); |
|
221 | + $openemisFather = $this->uniqueUid::getUniqueAlphanumeric(); |
|
222 | 222 | |
223 | 223 | $identityType = ($identityType !== null) ? $identityType->id : null; |
224 | 224 | $nationalityId = $nationalityId !== null ? $nationalityId->id : null; |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | |
233 | 233 | if ($father === null) { |
234 | 234 | $data = [ |
235 | - 'username' => str_replace('-','',$openemisFather), |
|
235 | + 'username' => str_replace('-', '', $openemisFather), |
|
236 | 236 | 'openemis_no' => $openemisFather, |
237 | 237 | 'first_name' => $row['fathers_full_name'], // here we save full name in the column of first name. re reduce breaks of the system. |
238 | 238 | 'last_name' => genNameWithInitials($row['fathers_full_name']), |
@@ -251,25 +251,25 @@ discard block |
||
251 | 251 | $father['guardian_relation_id'] = 1; |
252 | 252 | if (array_key_exists('fathers_phone', $row)) { |
253 | 253 | $father['contact'] = $row['fathers_phone']; |
254 | - User_contact::createOrUpdate($father,$this->file['security_user_id']); |
|
254 | + User_contact::createOrUpdate($father, $this->file['security_user_id']); |
|
255 | 255 | } |
256 | 256 | Student_guardian::createStudentGuardian($student, $father, $this->file['security_user_id']); |
257 | - } else { |
|
257 | + }else { |
|
258 | 258 | Security_user::where('id', '=', $father->id) |
259 | 259 | ->update(['is_guardian' => 1]); |
260 | 260 | $father['guardian_relation_id'] = 1; |
261 | 261 | if (array_key_exists('fathers_phone', $row)) { |
262 | 262 | $father['contact'] = $row['fathers_phone']; |
263 | - User_contact::createOrUpdate($father,$this->file['security_user_id']); |
|
263 | + User_contact::createOrUpdate($father, $this->file['security_user_id']); |
|
264 | 264 | } |
265 | 265 | Student_guardian::createStudentGuardian($student, $father, $this->file['security_user_id']); |
266 | 266 | } |
267 | 267 | } |
268 | 268 | |
269 | 269 | if (!empty($row['mothers_full_name']) && ($row['mothers_date_of_birth_yyyy_mm_dd'] !== null)) { |
270 | - $AddressArea = Area_administrative::where('name', 'like', '%' . $row['mothers_address_area'] . '%')->first(); |
|
271 | - $nationalityId = Nationality::where('name', 'like', '%' . $row['mothers_nationality'] . '%')->first(); |
|
272 | - $identityType = Identity_type::where('national_code', 'like', '%' . $row['mothers_identity_type'] . '%')->first(); |
|
270 | + $AddressArea = Area_administrative::where('name', 'like', '%'.$row['mothers_address_area'].'%')->first(); |
|
271 | + $nationalityId = Nationality::where('name', 'like', '%'.$row['mothers_nationality'].'%')->first(); |
|
272 | + $identityType = Identity_type::where('national_code', 'like', '%'.$row['mothers_identity_type'].'%')->first(); |
|
273 | 273 | $openemisMother = $this->uniqueUid::getUniqueAlphanumeric(); |
274 | 274 | |
275 | 275 | $identityType = $identityType !== null ? $identityType->id : null; |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | |
285 | 285 | if ($mother === null) { |
286 | 286 | $mother = Security_user::create([ |
287 | - 'username' => str_replace('-','',$openemisMother), |
|
287 | + 'username' => str_replace('-', '', $openemisMother), |
|
288 | 288 | 'openemis_no' => $openemisMother, |
289 | 289 | 'first_name' => $row['mothers_full_name'], // here we save full name in the column of first name. re reduce breaks of the system. |
290 | 290 | 'last_name' => genNameWithInitials($row['mothers_full_name']), |
@@ -302,16 +302,16 @@ discard block |
||
302 | 302 | $mother['guardian_relation_id'] = 2; |
303 | 303 | if (array_key_exists('mothers_phone', $row)) { |
304 | 304 | $mother['contact'] = $row['mothers_phone']; |
305 | - User_contact::createOrUpdate($mother,$this->file['security_user_id']); |
|
305 | + User_contact::createOrUpdate($mother, $this->file['security_user_id']); |
|
306 | 306 | } |
307 | 307 | Student_guardian::createStudentGuardian($student, $mother, $this->file['security_user_id']); |
308 | - } else { |
|
308 | + }else { |
|
309 | 309 | Security_user::where('id', '=', $mother->id) |
310 | 310 | ->update(['is_guardian' => 1]); |
311 | 311 | $mother['guardian_relation_id'] = 2; |
312 | 312 | if (array_key_exists('mothers_phone', $row)) { |
313 | 313 | $mother['contact'] = $row['mothers_phone']; |
314 | - User_contact::createOrUpdate($mother,$this->file['security_user_id']); |
|
314 | + User_contact::createOrUpdate($mother, $this->file['security_user_id']); |
|
315 | 315 | } |
316 | 316 | Student_guardian::createStudentGuardian($student, $mother, $this->file['security_user_id']); |
317 | 317 | } |
@@ -320,9 +320,9 @@ discard block |
||
320 | 320 | |
321 | 321 | if (!empty($row['guardians_full_name']) && ($row['guardians_date_of_birth_yyyy_mm_dd'] !== null)) { |
322 | 322 | $genderId = $row['guardians_gender_mf'] == 'M' ? 1 : 2; |
323 | - $AddressArea = Area_administrative::where('name', 'like', '%' . $row['guardians_address_area'] . '%')->first(); |
|
324 | - $nationalityId = Nationality::where('name', 'like', '%' . $row['guardians_nationality'] . '%')->first(); |
|
325 | - $identityType = Identity_type::where('national_code', 'like', '%' . $row['guardians_identity_type'] . '%')->first(); |
|
323 | + $AddressArea = Area_administrative::where('name', 'like', '%'.$row['guardians_address_area'].'%')->first(); |
|
324 | + $nationalityId = Nationality::where('name', 'like', '%'.$row['guardians_nationality'].'%')->first(); |
|
325 | + $identityType = Identity_type::where('national_code', 'like', '%'.$row['guardians_identity_type'].'%')->first(); |
|
326 | 326 | $openemisGuardian = $this->uniqueUid::getUniqueAlphanumeric(); |
327 | 327 | |
328 | 328 | $identityType = $identityType !== null ? $identityType->id : null; |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | |
338 | 338 | if ($guardian === null) { |
339 | 339 | $guardian = Security_user::create([ |
340 | - 'username' => str_replace('-','',$openemisGuardian), |
|
340 | + 'username' => str_replace('-', '', $openemisGuardian), |
|
341 | 341 | 'openemis_no' => $openemisGuardian, |
342 | 342 | 'first_name' => $row['guardians_full_name'], // here we save full name in the column of first name. re reduce breaks of the system. |
343 | 343 | 'last_name' => genNameWithInitials($row['guardians_full_name']), |
@@ -356,22 +356,22 @@ discard block |
||
356 | 356 | $guardian['guardian_relation_id'] = 3; |
357 | 357 | if (array_key_exists('guardians_phone', $row)) { |
358 | 358 | $guardian['contact'] = $row['guardians_phone']; |
359 | - User_contact::createOrUpdate($guardian,$this->file['security_user_id']); |
|
359 | + User_contact::createOrUpdate($guardian, $this->file['security_user_id']); |
|
360 | 360 | } |
361 | 361 | Student_guardian::createStudentGuardian($student, $guardian, $this->file['security_user_id']); |
362 | - } else { |
|
362 | + }else { |
|
363 | 363 | Security_user::where('id', '=', $guardian->id) |
364 | 364 | ->update(['is_guardian' => 1]); |
365 | 365 | $guardian['guardian_relation_id'] = 3; |
366 | 366 | if (array_key_exists('guardians_phone', $row)) { |
367 | 367 | $guardian['contact'] = $row['guardians_phone']; |
368 | - User_contact::createOrUpdate($guardian,$this->file['security_user_id']); |
|
368 | + User_contact::createOrUpdate($guardian, $this->file['security_user_id']); |
|
369 | 369 | } |
370 | 370 | Student_guardian::createStudentGuardian($student, $guardian, $this->file['security_user_id']); |
371 | 371 | } |
372 | 372 | } |
373 | 373 | |
374 | - $optionalSubjects = Institution_class_subject::getStudentOptionalSubject($subjects, $student, $row, $institution); |
|
374 | + $optionalSubjects = Institution_class_subject::getStudentOptionalSubject($subjects, $student, $row, $institution); |
|
375 | 375 | |
376 | 376 | $allSubjects = array_merge_recursive($optionalSubjects, $mandatorySubject); |
377 | 377 | // $stundetSubjects = $this->getStudentSubjects($student); |
@@ -380,10 +380,10 @@ discard block |
||
380 | 380 | if (!empty($allSubjects)) { |
381 | 381 | $allSubjects = unique_multidim_array($allSubjects, 'institution_subject_id'); |
382 | 382 | $this->student = $student; |
383 | - $allSubjects = array_map(array($this,'setStudentSubjects'),$allSubjects); |
|
383 | + $allSubjects = array_map(array($this, 'setStudentSubjects'), $allSubjects); |
|
384 | 384 | // $allSubjects = array_unique($allSubjects,SORT_REGULAR); |
385 | 385 | $allSubjects = unique_multidim_array($allSubjects, 'education_subject_id'); |
386 | - array_walk($allSubjects,array($this,'insertSubject')); |
|
386 | + array_walk($allSubjects, array($this, 'insertSubject')); |
|
387 | 387 | // Institution_subject_student::insert((array) $allSubjects); |
388 | 388 | // array_walk($allSubjects, array($this, 'updateSubjectCount')); |
389 | 389 | } |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | |
395 | 395 | if ($totalStudents['total'] > $institutionClass->no_of_students) { |
396 | 396 | $error = \Illuminate\Validation\ValidationException::withMessages([]); |
397 | - $failure = new Failure(3, 'rows', [3 => 'Class student count exceeded! Max number of students is ' . $institutionClass->no_of_students], [null]); |
|
397 | + $failure = new Failure(3, 'rows', [3 => 'Class student count exceeded! Max number of students is '.$institutionClass->no_of_students], [null]); |
|
398 | 398 | $failures = [0 => $failure]; |
399 | 399 | throw new \Maatwebsite\Excel\Validators\ValidationException($error, $failures); |
400 | 400 | Log::info('email-sent', [$this->file]); |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | 'total_male_students' => $totalStudents['total_male_students'], |
407 | 407 | 'total_female_students' => $totalStudents['total_female_students']]); |
408 | 408 | } |
409 | - } catch (\Maatwebsite\Excel\Validators\ValidationException $e) { |
|
409 | + }catch (\Maatwebsite\Excel\Validators\ValidationException $e) { |
|
410 | 410 | $error = \Illuminate\Validation\ValidationException::withMessages([]); |
411 | 411 | $failures = $e->failures(); |
412 | 412 | throw new \Maatwebsite\Excel\Validators\ValidationException($error, $failures); |
@@ -420,8 +420,8 @@ discard block |
||
420 | 420 | ->where('institution_class_id', '=', $student->institution_class_id)->get()->toArray(); |
421 | 421 | } |
422 | 422 | |
423 | - protected function insertSubject($subject){ |
|
424 | - if(!Institution_subject_student::isDuplicated($subject)) |
|
423 | + protected function insertSubject($subject) { |
|
424 | + if (!Institution_subject_student::isDuplicated($subject)) |
|
425 | 425 | Institution_subject_student::updateOrInsert($subject); |
426 | 426 | } |
427 | 427 | |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | '*.admission_no' => 'nullable|max:12|min:4', |
451 | 451 | '*.start_date_yyyy_mm_dd' => 'nullable|date', |
452 | 452 | '*.special_need_type' => 'nullable', |
453 | - '*.special_need' => 'nullable|exists:special_need_difficulties,name|required_if:special_need_type,Differantly Able',//|exists:special_need_difficulties,name |
|
453 | + '*.special_need' => 'nullable|exists:special_need_difficulties,name|required_if:special_need_type,Differantly Able', //|exists:special_need_difficulties,name |
|
454 | 454 | '*.fathers_full_name' => 'nullable|regex:/^[\pL\s\-]+$/u', |
455 | 455 | '*.fathers_date_of_birth_yyyy_mm_dd' => 'nullable|required_with:*.fathers_full_name', |
456 | 456 | '*.fathers_address' => 'required_with:*.fathers_full_name', |
@@ -32,8 +32,8 @@ |
||
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
35 | - * @return \Illuminate\Support\Collection |
|
36 | - */ |
|
35 | + * @return \Illuminate\Support\Collection |
|
36 | + */ |
|
37 | 37 | public function collection() |
38 | 38 | { |
39 | 39 | // |
@@ -6,7 +6,7 @@ |
||
6 | 6 | use App\Models\Examination_student; |
7 | 7 | use Maatwebsite\Excel\Concerns\WithHeadings; |
8 | 8 | |
9 | -class ExaminationStudentsExport implements FromCollection , WithHeadings |
|
9 | +class ExaminationStudentsExport implements FromCollection, WithHeadings |
|
10 | 10 | { |
11 | 11 | |
12 | 12 | public function headings(): array |
@@ -1,22 +1,22 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -function get_l_name($name){ |
|
3 | +function get_l_name($name) { |
|
4 | 4 | $name = trim($name); |
5 | - $last_name = (strpos($name,' ') === false) ? '' : preg_replace('#.*\s([\w-]*)$#', '$1', $name); |
|
5 | + $last_name = (strpos($name, ' ') === false) ? '' : preg_replace('#.*\s([\w-]*)$#', '$1', $name); |
|
6 | 6 | return $last_name; |
7 | 7 | } |
8 | 8 | |
9 | 9 | // Gen name with initials with help of fullname |
10 | -function genNameWithInitials($fullname = null){ |
|
10 | +function genNameWithInitials($fullname = null) { |
|
11 | 11 | $names = explode(' ', $fullname); |
12 | - $length = count($names); |
|
12 | + $length = count($names); |
|
13 | 13 | $Initials = ''; |
14 | - if($length > 1){ |
|
15 | - for ($i = 0; ($length-1) > $i; $i++) { |
|
16 | - $Initials = $Initials . '' . mb_substr($names[$i], 0, 1, "UTF-8"); |
|
14 | + if ($length > 1) { |
|
15 | + for ($i = 0; ($length - 1) > $i; $i++) { |
|
16 | + $Initials = $Initials.''.mb_substr($names[$i], 0, 1, "UTF-8"); |
|
17 | 17 | } |
18 | - $nameWithInitials = $Initials . ' ' . $names[$length - 1]; |
|
19 | - }else{ |
|
18 | + $nameWithInitials = $Initials.' '.$names[$length - 1]; |
|
19 | + }else { |
|
20 | 20 | $nameWithInitials = $fullname; |
21 | 21 | } |
22 | 22 | return $nameWithInitials; |
@@ -35,10 +35,10 @@ discard block |
||
35 | 35 | } |
36 | 36 | |
37 | 37 | |
38 | -function getMatchingKeys($array){ |
|
38 | +function getMatchingKeys($array) { |
|
39 | 39 | $keys = []; |
40 | - foreach ($array as $key => $value){ |
|
41 | - if(strstr($key , 'option')) |
|
40 | + foreach ($array as $key => $value) { |
|
41 | + if (strstr($key, 'option')) |
|
42 | 42 | $keys[] = $key; |
43 | 43 | } |
44 | 44 | return $keys; |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | return (bool) preg_match('/^[0-9a-f]{40}$/i', $str); |
49 | 49 | } |
50 | 50 | |
51 | -function isEmpty($value){ |
|
51 | +function isEmpty($value) { |
|
52 | 52 | return $value['institution_optional_subject'] !== null; |
53 | 53 | } |
54 | 54 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | $i = 0; |
58 | 58 | $key_array = array(); |
59 | 59 | |
60 | - foreach($array as $val) { |
|
60 | + foreach ($array as $val) { |
|
61 | 61 | if (!in_array($val[$key], $key_array)) { |
62 | 62 | $key_array[$i] = $val[$key]; |
63 | 63 | $temp_array[$i] = $val; |
@@ -69,10 +69,10 @@ discard block |
||
69 | 69 | |
70 | 70 | |
71 | 71 | |
72 | -function merge_two_arrays($array1,$array2) { |
|
72 | +function merge_two_arrays($array1, $array2) { |
|
73 | 73 | |
74 | 74 | $data = array(); |
75 | - $arrayAB = array_merge($array1,$array2); |
|
75 | + $arrayAB = array_merge($array1, $array2); |
|
76 | 76 | |
77 | 77 | foreach ($arrayAB as $value) { |
78 | 78 | dd($arrayAB); |
@@ -80,25 +80,25 @@ discard block |
||
80 | 80 | if (!isset($data[$id])) { |
81 | 81 | $data[$id] = array(); |
82 | 82 | } |
83 | - $data[$id] = array_merge($data[$id],$value); |
|
83 | + $data[$id] = array_merge($data[$id], $value); |
|
84 | 84 | } |
85 | 85 | return $data; |
86 | 86 | } |
87 | 87 | |
88 | -function array_value_recursive($key, array $arr){ |
|
88 | +function array_value_recursive($key, array $arr) { |
|
89 | 89 | $val = array(); |
90 | 90 | array_walk_recursive($arr, function($v, $k) use($key, &$val){ |
91 | - if($k == $key) array_push($val, $v); |
|
91 | + if ($k == $key) array_push($val, $v); |
|
92 | 92 | }); |
93 | 93 | return count($val) > 1 ? $val : array_pop($val); |
94 | 94 | } |
95 | 95 | |
96 | 96 | |
97 | -function merge_error_by_row($errors,$key){ |
|
97 | +function merge_error_by_row($errors, $key) { |
|
98 | 98 | $temp_array = array(); |
99 | 99 | $i = 0; |
100 | 100 | |
101 | - foreach($errors as $keys => $val) { |
|
101 | + foreach ($errors as $keys => $val) { |
|
102 | 102 | if (!in_array($val[$key], $temp_array)) { |
103 | 103 | $temp_array[$keys]['errors'][] = $val; |
104 | 104 | } |
@@ -114,17 +114,17 @@ discard block |
||
114 | 114 | * bind error messages to the excel file |
115 | 115 | */ |
116 | 116 | |
117 | -function append_errors_to_excel($error, $count, $reader){ |
|
117 | +function append_errors_to_excel($error, $count, $reader) { |
|
118 | 118 | $active_sheet = $reader->getActiveSheet(); |
119 | 119 | $prev_value = $active_sheet->getCell('A'.$error['row'])->getValue(); |
120 | - $active_sheet->setCellValue('A'. ($error['row']) , $prev_value.','.implode(',',$error['errors'])); |
|
121 | - $active_sheet->getStyle('A'. ($error['row']))->getAlignment()->setWrapText(true); |
|
120 | + $active_sheet->setCellValue('A'.($error['row']), $prev_value.','.implode(',', $error['errors'])); |
|
121 | + $active_sheet->getStyle('A'.($error['row']))->getAlignment()->setWrapText(true); |
|
122 | 122 | $columns = Illuminate\Support\Facades\Config::get('excel.columns'); |
123 | 123 | |
124 | - $column = array_keys($columns,$error['attribute']); |
|
125 | - if(!empty($column)){ |
|
126 | - $column = $column[0]+1; |
|
127 | - $selectedCells = $active_sheet->setSelectedCellByColumnAndRow($column,$error['row']); |
|
124 | + $column = array_keys($columns, $error['attribute']); |
|
125 | + if (!empty($column)) { |
|
126 | + $column = $column[0] + 1; |
|
127 | + $selectedCells = $active_sheet->setSelectedCellByColumnAndRow($column, $error['row']); |
|
128 | 128 | $active_cell = ($selectedCells->getActiveCell()); |
129 | 129 | |
130 | 130 | $active_sheet->getStyle($active_cell) |
@@ -136,23 +136,23 @@ discard block |
||
136 | 136 | } |
137 | 137 | } |
138 | 138 | |
139 | -function rows($error){ |
|
139 | +function rows($error) { |
|
140 | 140 | return $error['row']; |
141 | 141 | } |
142 | 142 | |
143 | -function rowIndex($row){ |
|
143 | +function rowIndex($row) { |
|
144 | 144 | return $row->getRowIndex(); |
145 | 145 | } |
146 | 146 | |
147 | -function removeRows($row,$param){ |
|
148 | - if(in_array($row,$param['rows'])){ |
|
147 | +function removeRows($row, $param) { |
|
148 | + if (in_array($row, $param['rows'])) { |
|
149 | 149 | $param['reader']->getActiveSheet()->removeRow($row); |
150 | 150 | } |
151 | 151 | } |
152 | 152 | |
153 | -function colorizeCell($column,$error,$active_sheet){ |
|
154 | - $column = array_keys($column,$error['attribute']); |
|
155 | - $selectedCells = $active_sheet->setSelectedCellByColumnAndRow($column,$error['row']); |
|
153 | +function colorizeCell($column, $error, $active_sheet) { |
|
154 | + $column = array_keys($column, $error['attribute']); |
|
155 | + $selectedCells = $active_sheet->setSelectedCellByColumnAndRow($column, $error['row']); |
|
156 | 156 | $active_cell = ($selectedCells->getActiveCell()); |
157 | 157 | |
158 | 158 | $active_sheet->getStyle($active_cell) |
@@ -164,14 +164,14 @@ discard block |
||
164 | 164 | } |
165 | 165 | |
166 | 166 | |
167 | -function errors_unique_array($item,$key){ |
|
167 | +function errors_unique_array($item, $key) { |
|
168 | 168 | |
169 | - $search = array_filter($item,function ($data) use ($item){ |
|
170 | - return isset($data['row']) && ($data['row'] == $item->row()); |
|
169 | + $search = array_filter($item, function($data) use ($item){ |
|
170 | + return isset($data['row']) && ($data['row'] == $item->row()); |
|
171 | 171 | }); |
172 | 172 | |
173 | - if($search){ |
|
174 | - array_push($search[0]['errors'],implode(',',$item->errors())); |
|
173 | + if ($search) { |
|
174 | + array_push($search[0]['errors'], implode(',', $item->errors())); |
|
175 | 175 | $errors = $search; |
176 | 176 | } |
177 | 177 | |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | } |
180 | 180 | |
181 | 181 | function isEmptyRow($row) { |
182 | - foreach($row as $cell){ |
|
182 | + foreach ($row as $cell) { |
|
183 | 183 | if (null !== $cell) return false; |
184 | 184 | } |
185 | 185 | return true; |
@@ -40,7 +40,7 @@ |
||
40 | 40 | { |
41 | 41 | $output = new \Symfony\Component\Console\Output\ConsoleOutput(); |
42 | 42 | $output->writeln('###########################################------Inserting file records------###########################################'); |
43 | - $this->examinationController = new ExaminationStudentsController($this->argument('year'),$this->argument('grade')); |
|
43 | + $this->examinationController = new ExaminationStudentsController($this->argument('year'), $this->argument('grade')); |
|
44 | 44 | $this->examinationController->doMatch(); |
45 | 45 | $output->writeln('###########################################------Finished inserting file records------###########################################'); |
46 | 46 | } |
@@ -31,16 +31,16 @@ discard block |
||
31 | 31 | $institution = Institution_class::find($file['institution_class_id']); |
32 | 32 | |
33 | 33 | $this->user = User::find($file['security_user_id']); |
34 | - $this->subject = 'SIS Bulk Upload: Upload Failed '.$institution->institution->code.': '. $institution->name . date('Y:m:d H:i:s'); |
|
34 | + $this->subject = 'SIS Bulk Upload: Upload Failed '.$institution->institution->code.': '.$institution->name.date('Y:m:d H:i:s'); |
|
35 | 35 | $this->from_address = env('MAIL_FROM_ADDRESS'); |
36 | 36 | $this->from_name = 'SIS Bulk Uploader'; |
37 | 37 | $this->with = [ |
38 | 38 | 'name' => $this->user->first_name, |
39 | - 'link' => env('APP_ENV','local') == 'stage' | 'local' | 'prod' ? env('APP_URL').'/download/' .$file['filename'] : env('APP_URL').'/bulk-upload/download/' .$file['filename'] |
|
39 | + 'link' => env('APP_ENV', 'local') == 'stage' | 'local' | 'prod' ? env('APP_URL').'/download/'.$file['filename'] : env('APP_URL').'/bulk-upload/download/'.$file['filename'] |
|
40 | 40 | ]; |
41 | 41 | $this->viewData = [ |
42 | 42 | 'name'=>$this->user->first_name, "body" => "The class you tried to import data is exceeded the student count limit.Please check the class / increase the student limit", |
43 | - 'link' => env('APP_ENV','local') == 'stage' | 'local' | 'prod' ? env('APP_URL').'/download/' .$file['filename'] : env('APP_URL').'/bulk-upload/download/' .$file['filename'] |
|
43 | + 'link' => env('APP_ENV', 'local') == 'stage' | 'local' | 'prod' ? env('APP_URL').'/download/'.$file['filename'] : env('APP_URL').'/bulk-upload/download/'.$file['filename'] |
|
44 | 44 | ]; |
45 | 45 | } |
46 | 46 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | public function build() |
53 | 53 | { |
54 | 54 | return $this->view('emails.mail') |
55 | - ->from($this->from_address,$this->from_name) |
|
55 | + ->from($this->from_address, $this->from_name) |
|
56 | 56 | ->to($this->user->email) |
57 | 57 | ->subject($this->subject) |
58 | 58 | ->with($this->with); |
@@ -23,16 +23,16 @@ discard block |
||
23 | 23 | |
24 | 24 | |
25 | 25 | $this->user = User::find($file['security_user_id']); |
26 | - $this->subject = 'SIS Bulk Upload: IncorrectTemplate'.$institution->institution->code.': '. $institution->name.' '. date('Y:m:d H:i:s'); |
|
26 | + $this->subject = 'SIS Bulk Upload: IncorrectTemplate'.$institution->institution->code.': '.$institution->name.' '.date('Y:m:d H:i:s'); |
|
27 | 27 | $this->from_address = env('MAIL_FROM_ADDRESS'); |
28 | 28 | $this->from_name = 'SIS Bulk Uploader'; |
29 | 29 | $this->with = [ |
30 | 30 | 'name' => $this->user->first_name, |
31 | - 'link' => env('APP_ENV','local') == 'stage' | 'local' | 'prod' ? env('APP_URL').'/download/' .$file['filename'] : env('APP_URL').'/bulk-upload/download/' .$file['filename'] |
|
31 | + 'link' => env('APP_ENV', 'local') == 'stage' | 'local' | 'prod' ? env('APP_URL').'/download/'.$file['filename'] : env('APP_URL').'/bulk-upload/download/'.$file['filename'] |
|
32 | 32 | ]; |
33 | 33 | $this->viewData = [ |
34 | 34 | 'name'=>$this->user->first_name, "body" => "The Template you used for upload having some issues, please reconfirm and re-upload with correct template", |
35 | - 'link' => env('APP_ENV','local') == 'stage' | 'local' | 'prod' ? env('APP_URL').'/download/' .$file['filename'] : env('APP_URL').'/bulk-upload/download/' .$file['filename'] |
|
35 | + 'link' => env('APP_ENV', 'local') == 'stage' | 'local' | 'prod' ? env('APP_URL').'/download/'.$file['filename'] : env('APP_URL').'/bulk-upload/download/'.$file['filename'] |
|
36 | 36 | ]; |
37 | 37 | } |
38 | 38 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | public function build() |
45 | 45 | { |
46 | 46 | return $this->view('emails.mail') |
47 | - ->from($this->from_address,$this->from_name) |
|
47 | + ->from($this->from_address, $this->from_name) |
|
48 | 48 | ->to($this->user->email) |
49 | 49 | ->subject($this->subject) |
50 | 50 | ->with($this->with); |
@@ -24,17 +24,17 @@ discard block |
||
24 | 24 | |
25 | 25 | |
26 | 26 | $this->user = User::find($file['security_user_id']); |
27 | - $this->subject = 'SIS Bulk Upload: ' .$file['subject']. $institution->institution->code.': '. $institution->name.' '. date('Y:m:d H:i:s'); |
|
27 | + $this->subject = 'SIS Bulk Upload: '.$file['subject'].$institution->institution->code.': '.$institution->name.' '.date('Y:m:d H:i:s'); |
|
28 | 28 | $this->from_address = env('MAIL_FROM_ADDRESS'); |
29 | 29 | $this->from_name = 'SIS Bulk Uploader'; |
30 | 30 | $this->with = [ |
31 | 31 | 'name' => $this->user->first_name, |
32 | - 'link' => env('APP_ENV','local') == 'stage' | 'local' | 'prod' ? env('APP_URL').'/download/' .$file['filename'] : env('APP_URL').'/bulk-upload/download/' .$file['filename'] |
|
32 | + 'link' => env('APP_ENV', 'local') == 'stage' | 'local' | 'prod' ? env('APP_URL').'/download/'.$file['filename'] : env('APP_URL').'/bulk-upload/download/'.$file['filename'] |
|
33 | 33 | ]; |
34 | 34 | $this->viewData = [ |
35 | - 'name'=>$this->user->first_name, "body" => "We found some errors on your data file ". $file['filename']. ' Pleas fix the errors and re-upload only with incorrect data, |
|
35 | + 'name'=>$this->user->first_name, "body" => "We found some errors on your data file ".$file['filename'].' Pleas fix the errors and re-upload only with incorrect data, |
|
36 | 36 | We uploaded the correct data to the system', |
37 | - 'link' => env('APP_ENV','local') == 'stage' | 'local' | 'prod' ? env('APP_URL').'/download/' .$file['filename'] : env('APP_URL').'/bulk-upload/download/' .$file['filename'] |
|
37 | + 'link' => env('APP_ENV', 'local') == 'stage' | 'local' | 'prod' ? env('APP_URL').'/download/'.$file['filename'] : env('APP_URL').'/bulk-upload/download/'.$file['filename'] |
|
38 | 38 | ]; |
39 | 39 | } |
40 | 40 | |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | public function build() |
47 | 47 | { |
48 | 48 | return $this->view('emails.mail') |
49 | - ->from($this->from_address,$this->from_name) |
|
49 | + ->from($this->from_address, $this->from_name) |
|
50 | 50 | ->to($this->user->email) |
51 | 51 | ->subject($this->subject) |
52 | 52 | ->with($this->with); |
@@ -25,16 +25,16 @@ discard block |
||
25 | 25 | |
26 | 26 | |
27 | 27 | $this->user = User::find($file['security_user_id']); |
28 | - $this->subject = 'SIS Bulk Upload: ' .$file['subject'].' Empty ' . $institution->institution->code.': '. $institution->name.' '. date('Y:m:d H:i:s'); |
|
28 | + $this->subject = 'SIS Bulk Upload: '.$file['subject'].' Empty '.$institution->institution->code.': '.$institution->name.' '.date('Y:m:d H:i:s'); |
|
29 | 29 | $this->from_address = env('MAIL_FROM_ADDRESS'); |
30 | 30 | $this->from_name = 'SIS Bulk Uploader'; |
31 | 31 | $this->with = [ |
32 | 32 | 'name' => $this->user->first_name, |
33 | - 'link' => env('APP_ENV','local') == 'stage' | 'local' | 'prod' ? env('APP_URL') : env('APP_URL').'bulk-upload/' |
|
33 | + 'link' => env('APP_ENV', 'local') == 'stage' | 'local' | 'prod' ? env('APP_URL') : env('APP_URL').'bulk-upload/' |
|
34 | 34 | ]; |
35 | 35 | $this->viewData = [ |
36 | - 'name'=>$this->user->first_name, "body" => "No data Found in ". $file['filename']. ' Please re-upload the file with data', |
|
37 | - 'link' => env('APP_ENV','local') == 'stage' | 'local' | 'prod' ? env('APP_URL') : env('APP_URL').'bulk-upload/' |
|
36 | + 'name'=>$this->user->first_name, "body" => "No data Found in ".$file['filename'].' Please re-upload the file with data', |
|
37 | + 'link' => env('APP_ENV', 'local') == 'stage' | 'local' | 'prod' ? env('APP_URL') : env('APP_URL').'bulk-upload/' |
|
38 | 38 | ]; |
39 | 39 | } |
40 | 40 | |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | public function build() |
47 | 47 | { |
48 | 48 | return $this->view('emails.mail') |
49 | - ->from($this->from_address,$this->from_name) |
|
49 | + ->from($this->from_address, $this->from_name) |
|
50 | 50 | ->to($this->user->email) |
51 | 51 | ->subject($this->subject) |
52 | 52 | ->with($this->with); |