@@ -25,11 +25,11 @@ |
||
25 | 25 | * |
26 | 26 | * @return void |
27 | 27 | */ |
28 | - public function boot() |
|
29 | - { |
|
30 | - // |
|
31 | - if(!(\App::environment('local'))) { |
|
32 | - URL::forceScheme('https'); |
|
33 | - } |
|
34 | - } |
|
28 | + public function boot() |
|
29 | + { |
|
30 | + // |
|
31 | + if(!(\App::environment('local'))) { |
|
32 | + URL::forceScheme('https'); |
|
33 | + } |
|
34 | + } |
|
35 | 35 | } |
@@ -28,7 +28,7 @@ |
||
28 | 28 | public function boot() |
29 | 29 | { |
30 | 30 | // |
31 | - if(!(\App::environment('local'))) { |
|
31 | + if (!(\App::environment('local'))) { |
|
32 | 32 | URL::forceScheme('https'); |
33 | 33 | } |
34 | 34 | } |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | |
5 | 5 | use Illuminate\Database\Eloquent\Model; |
6 | 6 | |
7 | -class Security_group_institution extends Model { |
|
7 | +class Security_group_institution extends Model { |
|
8 | 8 | |
9 | 9 | |
10 | 10 | /** |
@@ -44,21 +44,21 @@ discard block |
||
44 | 44 | |
45 | 45 | |
46 | 46 | |
47 | - public function institution(){ |
|
48 | - return $this->belongsTo('App\Models\Institution','institution_id'); |
|
47 | + public function institution() { |
|
48 | + return $this->belongsTo('App\Models\Institution', 'institution_id'); |
|
49 | 49 | } |
50 | 50 | |
51 | - public function institution_classes(){ |
|
52 | - return $this->hasMany('App\Models\Institution_class','institution_id','institution_id') |
|
51 | + public function institution_classes() { |
|
52 | + return $this->hasMany('App\Models\Institution_class', 'institution_id', 'institution_id') |
|
53 | 53 | ->select('institution_classes.*') |
54 | - ->join('academic_periods', function($query){ |
|
55 | - $query->on('institution_classes.academic_period_id','academic_periods.id'); |
|
56 | - $query->whereIn('academic_periods.code',['2020','2019/2020']); |
|
54 | + ->join('academic_periods', function($query) { |
|
55 | + $query->on('institution_classes.academic_period_id', 'academic_periods.id'); |
|
56 | + $query->whereIn('academic_periods.code', ['2020', '2019/2020']); |
|
57 | 57 | }); |
58 | 58 | } |
59 | 59 | |
60 | - public function security_group(){ |
|
61 | - return $this->belongsTo('App\Models\Security_group','security_group_id'); |
|
60 | + public function security_group() { |
|
61 | + return $this->belongsTo('App\Models\Security_group', 'security_group_id'); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | } |
65 | 65 | \ No newline at end of file |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | |
5 | 5 | use Illuminate\Database\Eloquent\Model; |
6 | 6 | |
7 | -class Security_group_user extends Model { |
|
7 | +class Security_group_user extends Model { |
|
8 | 8 | |
9 | 9 | public const CREATED_AT = 'created'; |
10 | 10 | public const UPDATED_AT = 'modified'; |
@@ -45,39 +45,39 @@ discard block |
||
45 | 45 | protected $dates = ['modified', 'created', 'created']; |
46 | 46 | |
47 | 47 | |
48 | - public function security_user(){ |
|
49 | - return $this->belongsToMany('App\Models\User','security_users'); |
|
48 | + public function security_user() { |
|
49 | + return $this->belongsToMany('App\Models\User', 'security_users'); |
|
50 | 50 | } |
51 | 51 | |
52 | - public function security_group(){ |
|
53 | - return $this->hasMany('App\Models\Security_group' , 'id','security_group_id'); |
|
52 | + public function security_group() { |
|
53 | + return $this->hasMany('App\Models\Security_group', 'id', 'security_group_id'); |
|
54 | 54 | } |
55 | 55 | |
56 | - public function security_group_institution(){ |
|
57 | - return $this->belongsTo('App\Models\Security_group_institution','security_group_id','security_group_id'); |
|
56 | + public function security_group_institution() { |
|
57 | + return $this->belongsTo('App\Models\Security_group_institution', 'security_group_id', 'security_group_id'); |
|
58 | 58 | } |
59 | 59 | |
60 | - public function staff_class(){ |
|
61 | - return $this->hasMany('App\Models\Institution_class','staff_id','security_user_id') |
|
60 | + public function staff_class() { |
|
61 | + return $this->hasMany('App\Models\Institution_class', 'staff_id', 'security_user_id') |
|
62 | 62 | ->select('institution_classes.*') |
63 | - ->join('academic_periods',function($query){ |
|
64 | - $query->on('institution_classes.academic_period_id','academic_periods.id'); |
|
65 | - $query->whereIn('academic_periods.code',['2020','2019/2020']); |
|
63 | + ->join('academic_periods', function($query) { |
|
64 | + $query->on('institution_classes.academic_period_id', 'academic_periods.id'); |
|
65 | + $query->whereIn('academic_periods.code', ['2020', '2019/2020']); |
|
66 | 66 | }); |
67 | 67 | } |
68 | 68 | |
69 | - public function institution_staff(){ |
|
70 | - return $this->belongsTo('App\Models\Institution_staff','security_user_id','staff_id'); |
|
69 | + public function institution_staff() { |
|
70 | + return $this->belongsTo('App\Models\Institution_staff', 'security_user_id', 'staff_id'); |
|
71 | 71 | } |
72 | 72 | |
73 | - public function institution_group(){ |
|
74 | - return $this->hasMany('App\Models\Security_group_institution','security_group_id','security_group_id') |
|
75 | - ->with(['institution','institution_classes']); |
|
73 | + public function institution_group() { |
|
74 | + return $this->hasMany('App\Models\Security_group_institution', 'security_group_id', 'security_group_id') |
|
75 | + ->with(['institution', 'institution_classes']); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | |
79 | - public function roles(){ |
|
80 | - return $this->belongsTo('App\Models\Security_role','security_role_id','id'); |
|
79 | + public function roles() { |
|
80 | + return $this->belongsTo('App\Models\Security_role', 'security_role_id', 'id'); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | |
5 | 5 | use Illuminate\Database\Eloquent\Model; |
6 | 6 | |
7 | -class Institution_staff extends Model { |
|
7 | +class Institution_staff extends Model { |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * The database table used by the model. |
@@ -42,13 +42,13 @@ discard block |
||
42 | 42 | protected $dates = ['start_date', 'end_date', 'modified', 'created']; |
43 | 43 | |
44 | 44 | |
45 | - public function staff_class(){ |
|
46 | - return $this->hasMany('App\Models\Institution_class','staff_id','staff_id') |
|
47 | - ->innerJoin('academic_periods','institution_classes.academic_period_id','academic_periods.id') |
|
48 | - ->where('academic_periods.current',1); |
|
45 | + public function staff_class() { |
|
46 | + return $this->hasMany('App\Models\Institution_class', 'staff_id', 'staff_id') |
|
47 | + ->innerJoin('academic_periods', 'institution_classes.academic_period_id', 'academic_periods.id') |
|
48 | + ->where('academic_periods.current', 1); |
|
49 | 49 | } |
50 | 50 | |
51 | - public function institution(){ |
|
52 | - return $this->belongsTo('App\Models\Institution','institution_id'); |
|
51 | + public function institution() { |
|
52 | + return $this->belongsTo('App\Models\Institution', 'institution_id'); |
|
53 | 53 | } |
54 | 54 | } |
55 | 55 | \ No newline at end of file |
@@ -75,7 +75,7 @@ discard block |
||
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 |
||
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([]); |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | $mandatorySubject = Institution_class_subject::getMandetorySubjects($this->file['institution_class_id']); |
115 | 115 | // dd($mandatorySubject); |
116 | 116 | $subjects = getMatchingKeys($row); |
117 | - $genderId = null; |
|
117 | + $genderId = null; |
|
118 | 118 | switch ($row['gender_mf']) { |
119 | 119 | case 'M': |
120 | 120 | $genderId = $row['gender_mf'] = 1; |
@@ -122,15 +122,15 @@ discard block |
||
122 | 122 | $this->maleStudentsCount += 1; |
123 | 123 | break; |
124 | 124 | case 'F': |
125 | - $genderId = $row['gender_mf'] = 2; |
|
125 | + $genderId = $row['gender_mf'] = 2; |
|
126 | 126 | $genderId = 2; |
127 | 127 | $this->femaleStudentsCount += 1; |
128 | 128 | break; |
129 | 129 | } |
130 | 130 | |
131 | - $BirthArea = Area_administrative::where('name', 'like', '%' . $row['birth_registrar_office_as_in_birth_certificate'] . '%')->first(); |
|
132 | - $nationalityId = Nationality::where('name', 'like', '%' . $row['nationality'] . '%')->first(); |
|
133 | - $identityType = Identity_type::where('national_code', 'like', '%' . $row['identity_type'] . '%')->first(); |
|
131 | + $BirthArea = Area_administrative::where('name', 'like', '%'.$row['birth_registrar_office_as_in_birth_certificate'].'%')->first(); |
|
132 | + $nationalityId = Nationality::where('name', 'like', '%'.$row['nationality'].'%')->first(); |
|
133 | + $identityType = Identity_type::where('national_code', 'like', '%'.$row['identity_type'].'%')->first(); |
|
134 | 134 | $academicPeriod = Academic_period::where('id', '=', $institutionClass->academic_period_id)->first(); |
135 | 135 | |
136 | 136 | |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | if (array_key_exists('preferred_name', $row)) { |
152 | 152 | $preferred_name = $row['preferred_name']; |
153 | 153 | } |
154 | - $student = Security_user::create([ |
|
154 | + $student = Security_user::create([ |
|
155 | 155 | 'username' => str_replace('-', '', $openemisStudent), |
156 | 156 | 'openemis_no' => $openemisStudent, |
157 | 157 | 'first_name' => $row['full_name'], // here we save full name in the column of first name. re reduce breaks of the system. |
@@ -232,9 +232,9 @@ discard block |
||
232 | 232 | if (!empty($row['bmi_weight']) && !empty($row['bmi_weight']) && !empty($row['bmi_date_yyyy_mm_dd'])) { |
233 | 233 | try { |
234 | 234 | // convert Meeter to CM |
235 | - $hight = $row['bmi_height'] / 100; |
|
235 | + $hight = $row['bmi_height']/100; |
|
236 | 236 | //calculate BMI |
237 | - $bodyMass = ($row['bmi_weight']) / pow($hight, 2); |
|
237 | + $bodyMass = ($row['bmi_weight'])/pow($hight, 2); |
|
238 | 238 | |
239 | 239 | $bmiAcademic = Academic_period::where('name', '=', $row['bmi_academic_period'])->first(); |
240 | 240 | |
@@ -248,17 +248,17 @@ discard block |
||
248 | 248 | 'security_user_id' => $student->student_id, |
249 | 249 | 'created_user_id' => $this->file['security_user_id'] |
250 | 250 | ]); |
251 | - } catch (\Throwable $th) { |
|
252 | - \Log::error('User_body_mass:' . $th->getMessage()); |
|
251 | + }catch (\Throwable $th) { |
|
252 | + \Log::error('User_body_mass:'.$th->getMessage()); |
|
253 | 253 | } |
254 | 254 | } |
255 | 255 | |
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; |
@@ -296,7 +296,7 @@ discard block |
||
296 | 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; |
@@ -309,9 +309,9 @@ discard block |
||
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; |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | User_contact::createOrUpdate($mother, $this->file['security_user_id']); |
348 | 348 | } |
349 | 349 | Student_guardian::createStudentGuardian($student, $mother, $this->file['security_user_id']); |
350 | - } else { |
|
350 | + }else { |
|
351 | 351 | Security_user::where('id', '=', $mother->id) |
352 | 352 | ->update(['is_guardian' => 1]); |
353 | 353 | $mother['guardian_relation_id'] = 2; |
@@ -362,9 +362,9 @@ discard block |
||
362 | 362 | |
363 | 363 | if (!empty($row['guardians_full_name']) && ($row['guardians_date_of_birth_yyyy_mm_dd'] !== null)) { |
364 | 364 | $genderId = $row['guardians_gender_mf'] == 'M' ? 1 : 2; |
365 | - $AddressArea = Area_administrative::where('name', 'like', '%' . $row['guardians_address_area'] . '%')->first(); |
|
366 | - $nationalityId = Nationality::where('name', 'like', '%' . $row['guardians_nationality'] . '%')->first(); |
|
367 | - $identityType = Identity_type::where('national_code', 'like', '%' . $row['guardians_identity_type'] . '%')->first(); |
|
365 | + $AddressArea = Area_administrative::where('name', 'like', '%'.$row['guardians_address_area'].'%')->first(); |
|
366 | + $nationalityId = Nationality::where('name', 'like', '%'.$row['guardians_nationality'].'%')->first(); |
|
367 | + $identityType = Identity_type::where('national_code', 'like', '%'.$row['guardians_identity_type'].'%')->first(); |
|
368 | 368 | $openemisGuardian = $this->uniqueUid::getUniqueAlphanumeric(); |
369 | 369 | |
370 | 370 | $identityType = $identityType !== null ? $identityType->id : null; |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | User_contact::createOrUpdate($guardian, $this->file['security_user_id']); |
402 | 402 | } |
403 | 403 | Student_guardian::createStudentGuardian($student, $guardian, $this->file['security_user_id']); |
404 | - } else { |
|
404 | + }else { |
|
405 | 405 | Security_user::where('id', '=', $guardian->id) |
406 | 406 | ->update(['is_guardian' => 1]); |
407 | 407 | $guardian['guardian_relation_id'] = 3; |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | |
436 | 436 | if ($totalStudents['total'] > $institutionClass->no_of_students) { |
437 | 437 | $error = \Illuminate\Validation\ValidationException::withMessages([]); |
438 | - $failure = new Failure(3, 'rows', [3 => 'Class student count exceeded! Max number of students is ' . $institutionClass->no_of_students], [null]); |
|
438 | + $failure = new Failure(3, 'rows', [3 => 'Class student count exceeded! Max number of students is '.$institutionClass->no_of_students], [null]); |
|
439 | 439 | $failures = [0 => $failure]; |
440 | 440 | throw new \Maatwebsite\Excel\Validators\ValidationException($error, $failures); |
441 | 441 | Log::info('email-sent', [$this->file]); |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | 'total_female_students' => $totalStudents['total_female_students'] |
448 | 448 | ]); |
449 | 449 | } |
450 | - } catch (\Maatwebsite\Excel\Validators\ValidationException $e) { |
|
450 | + }catch (\Maatwebsite\Excel\Validators\ValidationException $e) { |
|
451 | 451 | $error = \Illuminate\Validation\ValidationException::withMessages([]); |
452 | 452 | // $failure = new Failure(3, 'remark', [3 => ], [null]); |
453 | 453 | $failures = $e->failures(); |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | '*.full_name' => 'required|regex:/^[\pL\s\-]+$/u|max:256', |
464 | 464 | '*.preferred_name' => 'nullable|regex:/^[\pL\s\-]+$/u|max:90', |
465 | 465 | '*.gender_mf' => 'required|in:M,F', |
466 | - '*.date_of_birth_yyyy_mm_dd' => 'date|required|admission_age:' . $this->file['institution_class_id'], |
|
466 | + '*.date_of_birth_yyyy_mm_dd' => 'date|required|admission_age:'.$this->file['institution_class_id'], |
|
467 | 467 | '*.address' => 'nullable', |
468 | 468 | '*.birth_registrar_office_as_in_birth_certificate' => 'nullable|exists:area_administratives,name|required_if:identity_type,BC|birth_place', |
469 | 469 | '*.birth_divisional_secretariat' => 'nullable|exists:area_administratives,name|required_with:birth_registrar_office_as_in_birth_certificate', |
@@ -472,8 +472,8 @@ discard block |
||
472 | 472 | '*.identity_number' => 'nullable|identity:identity_type|required_with:*.identity_type', |
473 | 473 | '*.education_grade' => 'required', |
474 | 474 | '*.option_*' => 'nullable|exists:education_subjects,name', |
475 | - '*.bmi_height' => 'bail|required_with:*.bmi_weight|bmi:' . $this->file['institution_class_id'], |
|
476 | - '*.bmi_weight' => 'bail|required_with:*.bmi_height|bmi:' . $this->file['institution_class_id'], |
|
475 | + '*.bmi_height' => 'bail|required_with:*.bmi_weight|bmi:'.$this->file['institution_class_id'], |
|
476 | + '*.bmi_weight' => 'bail|required_with:*.bmi_height|bmi:'.$this->file['institution_class_id'], |
|
477 | 477 | '*.bmi_date_yyyy_mm_dd' => 'bail|required_with:*.bmi_height|date', //bmi:'. $this->file['institution_class_id'].' |
478 | 478 | '*.bmi_academic_period' => 'bail|required_with:*.bmi_height|exists:academic_periods,name', |
479 | 479 | '*.admission_no' => 'required|max:12|min:4|regex:/^[A-Za-z0-9\/]+$/', |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | use Maatwebsite\Excel\Concerns\WithMultipleSheets; |
56 | 56 | use Maatwebsite\Excel\Concerns\RegistersEventListeners; |
57 | 57 | |
58 | -class StudentUpdate extends Import implements ToModel, WithStartRow, WithHeadingRow, WithMultipleSheets, WithEvents, WithMapping, WithLimit, WithBatchInserts, WithValidation , SkipsOnFailure , SkipsOnError{ |
|
58 | +class StudentUpdate extends Import implements ToModel, WithStartRow, WithHeadingRow, WithMultipleSheets, WithEvents, WithMapping, WithLimit, WithBatchInserts, WithValidation, SkipsOnFailure, SkipsOnError{ |
|
59 | 59 | |
60 | 60 | use Importable, |
61 | 61 | RegistersEventListeners, |
@@ -110,9 +110,9 @@ discard block |
||
110 | 110 | break; |
111 | 111 | } |
112 | 112 | |
113 | - $BirthArea = Area_administrative::where('name', 'like', '%' . $row['birth_registrar_office_as_in_birth_certificate'] . '%')->first(); |
|
114 | - $nationalityId = Nationality::where('name', 'like', '%' . $row['nationality'] . '%')->first(); |
|
115 | - $identityType = Identity_type::where('national_code', 'like', '%' . $row['identity_type'] . '%')->first(); |
|
113 | + $BirthArea = Area_administrative::where('name', 'like', '%'.$row['birth_registrar_office_as_in_birth_certificate'].'%')->first(); |
|
114 | + $nationalityId = Nationality::where('name', 'like', '%'.$row['nationality'].'%')->first(); |
|
115 | + $identityType = Identity_type::where('national_code', 'like', '%'.$row['identity_type'].'%')->first(); |
|
116 | 116 | |
117 | 117 | $date = $row['date_of_birth_yyyy_mm_dd']; |
118 | 118 | |
@@ -159,9 +159,9 @@ discard block |
||
159 | 159 | ->update(['admission_id'=> $row['admission_no']]); |
160 | 160 | }*/ |
161 | 161 | |
162 | - if(!empty($row['admission_no'])){ |
|
163 | - Institution_student::where('student_id','=',$studentInfo->id) |
|
164 | - ->where('institution_id','=', $institution) |
|
162 | + if (!empty($row['admission_no'])) { |
|
163 | + Institution_student::where('student_id', '=', $studentInfo->id) |
|
164 | + ->where('institution_id', '=', $institution) |
|
165 | 165 | ->update(['admission_id'=> $row['admission_no']]); |
166 | 166 | } |
167 | 167 | if (!empty($row['special_need'])) { |
@@ -186,17 +186,17 @@ discard block |
||
186 | 186 | if (!empty($row['bmi_height']) && (!empty($row['bmi_weight']))) { |
187 | 187 | |
188 | 188 | // convert Meeter to CM |
189 | - $hight = $row['bmi_height'] / 100; |
|
189 | + $hight = $row['bmi_height']/100; |
|
190 | 190 | |
191 | 191 | //calculate BMI |
192 | - $bodyMass = ($row['bmi_weight']) / pow($hight, 2); |
|
192 | + $bodyMass = ($row['bmi_weight'])/pow($hight, 2); |
|
193 | 193 | |
194 | 194 | $bmiAcademic = Academic_period::where('name', '=', $row['bmi_academic_period'])->first(); |
195 | - $count = User_body_mass::where('academic_period_id' ,'=',$bmiAcademic->id ) |
|
196 | - ->where('security_user_id','=',$student->student_id)->count(); |
|
195 | + $count = User_body_mass::where('academic_period_id', '=', $bmiAcademic->id) |
|
196 | + ->where('security_user_id', '=', $student->student_id)->count(); |
|
197 | 197 | |
198 | 198 | \Log::debug('User_body_mass'); |
199 | - if(!($count > 0)){ |
|
199 | + if (!($count > 0)) { |
|
200 | 200 | User_body_mass::create([ |
201 | 201 | 'height' => $row['bmi_height'], |
202 | 202 | 'weight' => $row['bmi_weight'], |
@@ -210,10 +210,10 @@ discard block |
||
210 | 210 | } |
211 | 211 | |
212 | 212 | if (!empty($row['fathers_full_name']) && ($row['fathers_date_of_birth_yyyy_mm_dd'] !== null)) { |
213 | - $AddressArea = Area_administrative::where('name', 'like', '%' . $row['fathers_address_area'] . '%')->first(); |
|
214 | - $nationalityId = Nationality::where('name', 'like', '%' . $row['fathers_nationality'] . '%')->first(); |
|
215 | - $identityType = Identity_type::where('national_code', 'like', '%' . $row['fathers_identity_type'] . '%')->first(); |
|
216 | - $openemisFather = $this->uniqueUid::getUniqueAlphanumeric(); |
|
213 | + $AddressArea = Area_administrative::where('name', 'like', '%'.$row['fathers_address_area'].'%')->first(); |
|
214 | + $nationalityId = Nationality::where('name', 'like', '%'.$row['fathers_nationality'].'%')->first(); |
|
215 | + $identityType = Identity_type::where('national_code', 'like', '%'.$row['fathers_identity_type'].'%')->first(); |
|
216 | + $openemisFather = $this->uniqueUid::getUniqueAlphanumeric(); |
|
217 | 217 | |
218 | 218 | $identityType = ($identityType !== null) ? $identityType->id : null; |
219 | 219 | $nationalityId = $nationalityId !== null ? $nationalityId->id : null; |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | |
228 | 228 | if ($father === null) { |
229 | 229 | $data = [ |
230 | - 'username' => str_replace('-','',$openemisFather), |
|
230 | + 'username' => str_replace('-', '', $openemisFather), |
|
231 | 231 | 'openemis_no' => $openemisFather, |
232 | 232 | 'first_name' => $row['fathers_full_name'], // here we save full name in the column of first name. re reduce breaks of the system. |
233 | 233 | 'last_name' => genNameWithInitials($row['fathers_full_name']), |
@@ -246,25 +246,25 @@ discard block |
||
246 | 246 | $father['guardian_relation_id'] = 1; |
247 | 247 | if (array_key_exists('fathers_phone', $row)) { |
248 | 248 | $father['contact'] = $row['fathers_phone']; |
249 | - User_contact::createOrUpdate($father,$this->file['security_user_id']); |
|
249 | + User_contact::createOrUpdate($father, $this->file['security_user_id']); |
|
250 | 250 | } |
251 | 251 | Student_guardian::createStudentGuardian($student, $father, $this->file['security_user_id']); |
252 | - } else { |
|
252 | + }else { |
|
253 | 253 | Security_user::where('id', '=', $father->id) |
254 | 254 | ->update(['is_guardian' => 1]); |
255 | 255 | $father['guardian_relation_id'] = 1; |
256 | 256 | if (array_key_exists('fathers_phone', $row)) { |
257 | 257 | $father['contact'] = $row['fathers_phone']; |
258 | - User_contact::createOrUpdate($father,$this->file['security_user_id']); |
|
258 | + User_contact::createOrUpdate($father, $this->file['security_user_id']); |
|
259 | 259 | } |
260 | 260 | Student_guardian::createStudentGuardian($student, $father, $this->file['security_user_id']); |
261 | 261 | } |
262 | 262 | } |
263 | 263 | |
264 | 264 | if (!empty($row['mothers_full_name']) && ($row['mothers_date_of_birth_yyyy_mm_dd'] !== null)) { |
265 | - $AddressArea = Area_administrative::where('name', 'like', '%' . $row['mothers_address_area'] . '%')->first(); |
|
266 | - $nationalityId = Nationality::where('name', 'like', '%' . $row['mothers_nationality'] . '%')->first(); |
|
267 | - $identityType = Identity_type::where('national_code', 'like', '%' . $row['mothers_identity_type'] . '%')->first(); |
|
265 | + $AddressArea = Area_administrative::where('name', 'like', '%'.$row['mothers_address_area'].'%')->first(); |
|
266 | + $nationalityId = Nationality::where('name', 'like', '%'.$row['mothers_nationality'].'%')->first(); |
|
267 | + $identityType = Identity_type::where('national_code', 'like', '%'.$row['mothers_identity_type'].'%')->first(); |
|
268 | 268 | $openemisMother = $this->uniqueUid::getUniqueAlphanumeric(); |
269 | 269 | |
270 | 270 | $identityType = $identityType !== null ? $identityType->id : null; |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | |
280 | 280 | if ($mother === null) { |
281 | 281 | $mother = Security_user::create([ |
282 | - 'username' => str_replace('-','',$openemisMother), |
|
282 | + 'username' => str_replace('-', '', $openemisMother), |
|
283 | 283 | 'openemis_no' => $openemisMother, |
284 | 284 | 'first_name' => $row['mothers_full_name'], // here we save full name in the column of first name. re reduce breaks of the system. |
285 | 285 | 'last_name' => genNameWithInitials($row['mothers_full_name']), |
@@ -297,16 +297,16 @@ discard block |
||
297 | 297 | $mother['guardian_relation_id'] = 2; |
298 | 298 | if (array_key_exists('mothers_phone', $row)) { |
299 | 299 | $mother['contact'] = $row['mothers_phone']; |
300 | - User_contact::createOrUpdate($mother,$this->file['security_user_id']); |
|
300 | + User_contact::createOrUpdate($mother, $this->file['security_user_id']); |
|
301 | 301 | } |
302 | 302 | Student_guardian::createStudentGuardian($student, $mother, $this->file['security_user_id']); |
303 | - } else { |
|
303 | + }else { |
|
304 | 304 | Security_user::where('id', '=', $mother->id) |
305 | 305 | ->update(['is_guardian' => 1]); |
306 | 306 | $mother['guardian_relation_id'] = 2; |
307 | 307 | if (array_key_exists('mothers_phone', $row)) { |
308 | 308 | $mother['contact'] = $row['mothers_phone']; |
309 | - User_contact::createOrUpdate($mother,$this->file['security_user_id']); |
|
309 | + User_contact::createOrUpdate($mother, $this->file['security_user_id']); |
|
310 | 310 | } |
311 | 311 | Student_guardian::createStudentGuardian($student, $mother, $this->file['security_user_id']); |
312 | 312 | } |
@@ -315,9 +315,9 @@ discard block |
||
315 | 315 | |
316 | 316 | if (!empty($row['guardians_full_name']) && ($row['guardians_date_of_birth_yyyy_mm_dd'] !== null)) { |
317 | 317 | $genderId = $row['guardians_gender_mf'] == 'M' ? 1 : 2; |
318 | - $AddressArea = Area_administrative::where('name', 'like', '%' . $row['guardians_address_area'] . '%')->first(); |
|
319 | - $nationalityId = Nationality::where('name', 'like', '%' . $row['guardians_nationality'] . '%')->first(); |
|
320 | - $identityType = Identity_type::where('national_code', 'like', '%' . $row['guardians_identity_type'] . '%')->first(); |
|
318 | + $AddressArea = Area_administrative::where('name', 'like', '%'.$row['guardians_address_area'].'%')->first(); |
|
319 | + $nationalityId = Nationality::where('name', 'like', '%'.$row['guardians_nationality'].'%')->first(); |
|
320 | + $identityType = Identity_type::where('national_code', 'like', '%'.$row['guardians_identity_type'].'%')->first(); |
|
321 | 321 | $openemisGuardian = $this->uniqueUid::getUniqueAlphanumeric(); |
322 | 322 | |
323 | 323 | $identityType = $identityType !== null ? $identityType->id : null; |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | |
333 | 333 | if ($guardian === null) { |
334 | 334 | $guardian = Security_user::create([ |
335 | - 'username' => str_replace('-','',$openemisGuardian), |
|
335 | + 'username' => str_replace('-', '', $openemisGuardian), |
|
336 | 336 | 'openemis_no' => $openemisGuardian, |
337 | 337 | 'first_name' => $row['guardians_full_name'], // here we save full name in the column of first name. re reduce breaks of the system. |
338 | 338 | 'last_name' => genNameWithInitials($row['guardians_full_name']), |
@@ -351,23 +351,23 @@ discard block |
||
351 | 351 | $guardian['guardian_relation_id'] = 3; |
352 | 352 | if (array_key_exists('guardians_phone', $row)) { |
353 | 353 | $guardian['contact'] = $row['guardians_phone']; |
354 | - User_contact::createOrUpdate($guardian,$this->file['security_user_id']); |
|
354 | + User_contact::createOrUpdate($guardian, $this->file['security_user_id']); |
|
355 | 355 | } |
356 | 356 | Student_guardian::createStudentGuardian($student, $guardian, $this->file['security_user_id']); |
357 | - } else { |
|
357 | + }else { |
|
358 | 358 | Security_user::where('id', '=', $guardian->id) |
359 | 359 | ->update(['is_guardian' => 1]); |
360 | 360 | $guardian['guardian_relation_id'] = 3; |
361 | 361 | if (array_key_exists('guardians_phone', $row)) { |
362 | 362 | $guardian['contact'] = $row['guardians_phone']; |
363 | - User_contact::createOrUpdate($guardian,$this->file['security_user_id']); |
|
363 | + User_contact::createOrUpdate($guardian, $this->file['security_user_id']); |
|
364 | 364 | } |
365 | 365 | Student_guardian::createStudentGuardian($student, $guardian, $this->file['security_user_id']); |
366 | 366 | } |
367 | 367 | } |
368 | 368 | Institution_student::updateStudentArea($student); |
369 | 369 | |
370 | - $optionalSubjects = Institution_class_subject::getStudentOptionalSubject($subjects, $student, $row, $institution); |
|
370 | + $optionalSubjects = Institution_class_subject::getStudentOptionalSubject($subjects, $student, $row, $institution); |
|
371 | 371 | |
372 | 372 | $allSubjects = array_merge_recursive($optionalSubjects, $mandatorySubject); |
373 | 373 | // $stundetSubjects = $this->getStudentSubjects($student); |
@@ -376,9 +376,9 @@ discard block |
||
376 | 376 | if (!empty($allSubjects)) { |
377 | 377 | $allSubjects = unique_multidim_array($allSubjects, 'institution_subject_id'); |
378 | 378 | $this->student = $student; |
379 | - $allSubjects = array_map(array($this,'setStudentSubjects'),$allSubjects); |
|
379 | + $allSubjects = array_map(array($this, 'setStudentSubjects'), $allSubjects); |
|
380 | 380 | $allSubjects = unique_multidim_array($allSubjects, 'education_subject_id'); |
381 | - array_walk($allSubjects,array($this,'insertSubject')); |
|
381 | + array_walk($allSubjects, array($this, 'insertSubject')); |
|
382 | 382 | array_walk($allSubjects, array($this, 'updateSubjectCount')); |
383 | 383 | } |
384 | 384 | |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | 'total_male_students' => $totalStudents['total_male_students'], |
392 | 392 | 'total_female_students' => $totalStudents['total_female_students']]); |
393 | 393 | } |
394 | - } catch (\Maatwebsite\Excel\Validators\ValidationException $e) { |
|
394 | + }catch (\Maatwebsite\Excel\Validators\ValidationException $e) { |
|
395 | 395 | $error = \Illuminate\Validation\ValidationException::withMessages([]); |
396 | 396 | $failures = $e->failures(); |
397 | 397 | throw new \Maatwebsite\Excel\Validators\ValidationException($error, $failures); |