@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | use Illuminate\Database\Eloquent\SoftDeletes; |
8 | 8 | use Webpatser\Uuid\Uuid; |
9 | 9 | |
10 | -class Student_guardian extends Base_Model { |
|
10 | +class Student_guardian extends Base_Model { |
|
11 | 11 | |
12 | 12 | use SoftDeletes; |
13 | 13 | |
@@ -59,21 +59,21 @@ discard block |
||
59 | 59 | public static function boot() |
60 | 60 | { |
61 | 61 | parent::boot(); |
62 | - self::creating(function ($model) { |
|
62 | + self::creating(function($model) { |
|
63 | 63 | $model->id = (string) Uuid::generate(4); |
64 | 64 | $model->created_user_id = 1; |
65 | 65 | }); |
66 | 66 | } |
67 | 67 | |
68 | - public static function createStudentGuardian($student,$guardian,$user){ |
|
68 | + public static function createStudentGuardian($student, $guardian, $user) { |
|
69 | 69 | |
70 | 70 | $exist = true; |
71 | - if(!is_null($guardian)) |
|
71 | + if (!is_null($guardian)) |
|
72 | 72 | $exist = self::where('student_id', $student->student_id) |
73 | 73 | ->where('guardian_relation_id', $guardian->guardian_relation_id) |
74 | 74 | ->exists(); |
75 | 75 | |
76 | - $totalGuardians = self::where('student_id',$student->student_id)->count(); |
|
76 | + $totalGuardians = self::where('student_id', $student->student_id)->count(); |
|
77 | 77 | |
78 | 78 | $data = [ |
79 | 79 | 'student_id' => $student->student_id, |
@@ -81,13 +81,13 @@ discard block |
||
81 | 81 | 'guardian_relation_id' => $guardian->guardian_relation_id, |
82 | 82 | 'created_user_id' => $user |
83 | 83 | ]; |
84 | - if(!$exist){ |
|
84 | + if (!$exist) { |
|
85 | 85 | $data['created'] = now(); |
86 | 86 | self::create($data); |
87 | - }else{ |
|
87 | + }else { |
|
88 | 88 | $data['modified'] = now(); |
89 | - self::where('student_id' , $student->student_id) |
|
90 | - ->where('guardian_relation_id',$guardian->guardian_relation_id) |
|
89 | + self::where('student_id', $student->student_id) |
|
90 | + ->where('guardian_relation_id', $guardian->guardian_relation_id) |
|
91 | 91 | ->update($data); |
92 | 92 | } |
93 | 93 | } |
@@ -68,10 +68,11 @@ discard block |
||
68 | 68 | public static function createStudentGuardian($student,$guardian,$user){ |
69 | 69 | |
70 | 70 | $exist = true; |
71 | - if(!is_null($guardian)) |
|
72 | - $exist = self::where('student_id', $student->student_id) |
|
71 | + if(!is_null($guardian)) { |
|
72 | + $exist = self::where('student_id', $student->student_id) |
|
73 | 73 | ->where('guardian_relation_id', $guardian->guardian_relation_id) |
74 | 74 | ->exists(); |
75 | + } |
|
75 | 76 | |
76 | 77 | $totalGuardians = self::where('student_id',$student->student_id)->count(); |
77 | 78 | |
@@ -84,7 +85,7 @@ discard block |
||
84 | 85 | if(!$exist){ |
85 | 86 | $data['created'] = now(); |
86 | 87 | self::create($data); |
87 | - }else{ |
|
88 | + } else{ |
|
88 | 89 | $data['modified'] = now(); |
89 | 90 | self::where('student_id' , $student->student_id) |
90 | 91 | ->where('guardian_relation_id',$guardian->guardian_relation_id) |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | |
5 | 5 | use Illuminate\Database\Eloquent\Model; |
6 | 6 | |
7 | -class User_body_mass extends Base_Model { |
|
7 | +class User_body_mass extends Base_Model { |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * The database table used by the model. |
@@ -48,17 +48,17 @@ discard block |
||
48 | 48 | protected $dates = ['date', 'modified', 'created']; |
49 | 49 | |
50 | 50 | |
51 | - public static function createOrUpdate($studentId,$row,$file){ |
|
51 | + public static function createOrUpdate($studentId, $row, $file) { |
|
52 | 52 | if (!empty($row['bmi_weight']) && !empty($row['bmi_weight']) && !empty($row['bmi_date_yyyy_mm_dd'])) { |
53 | 53 | try { |
54 | 54 | // convert Meeter to CM |
55 | - $hight = $row['bmi_height'] / 100; |
|
55 | + $hight = $row['bmi_height']/100; |
|
56 | 56 | //calculate BMI |
57 | - $bodyMass = ($row['bmi_weight']) / pow($hight, 2); |
|
57 | + $bodyMass = ($row['bmi_weight'])/pow($hight, 2); |
|
58 | 58 | $bmiAcademic = Academic_period::where('name', '=', $row['bmi_academic_period'])->first(); |
59 | 59 | |
60 | - $count = User_body_mass::where('academic_period_id' ,'=',$bmiAcademic->id) |
|
61 | - ->where('security_user_id',$studentId)->count(); |
|
60 | + $count = User_body_mass::where('academic_period_id', '=', $bmiAcademic->id) |
|
61 | + ->where('security_user_id', $studentId)->count(); |
|
62 | 62 | $data = [ |
63 | 63 | 'height' => $row['bmi_height'], |
64 | 64 | 'weight' => $row['bmi_weight'], |
@@ -69,14 +69,14 @@ discard block |
||
69 | 69 | 'created_user_id' => $file['security_user_id'] |
70 | 70 | ]; |
71 | 71 | // dd($data); |
72 | - if($count == 0){ |
|
72 | + if ($count == 0) { |
|
73 | 73 | self::create($data); |
74 | - }else{ |
|
75 | - self::where('security_user_id',$studentId) |
|
74 | + }else { |
|
75 | + self::where('security_user_id', $studentId) |
|
76 | 76 | ->update($data); |
77 | 77 | } |
78 | - } catch (\Throwable $th) { |
|
79 | - \Log::error('User_body_mass:' . $th->getMessage()); |
|
78 | + }catch (\Throwable $th) { |
|
79 | + \Log::error('User_body_mass:'.$th->getMessage()); |
|
80 | 80 | } |
81 | 81 | } |
82 | 82 | } |
@@ -71,7 +71,7 @@ |
||
71 | 71 | // dd($data); |
72 | 72 | if($count == 0){ |
73 | 73 | self::create($data); |
74 | - }else{ |
|
74 | + } else{ |
|
75 | 75 | self::where('security_user_id',$studentId) |
76 | 76 | ->update($data); |
77 | 77 | } |
@@ -140,7 +140,7 @@ |
||
140 | 140 | } |
141 | 141 | |
142 | 142 | public static function createOrUpdate($studentId,$params,$file){ |
143 | - return self::create([ |
|
143 | + return self::create([ |
|
144 | 144 | 'student_id' => $studentId, |
145 | 145 | 'institution_class_id' => $params['institution_class']->id, |
146 | 146 | 'education_grade_id' => $params['institution_grade']->education_grade_id, |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | public static function boot() |
59 | 59 | { |
60 | 60 | parent::boot(); |
61 | - self::creating(function ($model) { |
|
61 | + self::creating(function($model) { |
|
62 | 62 | $model->id = (string) Uuid::generate(4); |
63 | 63 | $model->created = now(); |
64 | 64 | }); |
@@ -71,15 +71,15 @@ discard block |
||
71 | 71 | |
72 | 72 | public static function getStudentsCount($institution_class_id) |
73 | 73 | { |
74 | - $total_male_students = self::with(['student' => function ($query) { |
|
74 | + $total_male_students = self::with(['student' => function($query) { |
|
75 | 75 | $query->where('student.gender_id', '=', 1); |
76 | - }])->whereHas('student', function ($query) { |
|
76 | + }])->whereHas('student', function($query) { |
|
77 | 77 | $query->where('gender_id', '=', 1); |
78 | 78 | })->where('institution_class_id', '=', $institution_class_id)->count(); |
79 | 79 | |
80 | - $total_female_students = self::with(['student' => function ($query) { |
|
80 | + $total_female_students = self::with(['student' => function($query) { |
|
81 | 81 | $query->where('student.gender_id', '=', 2); |
82 | - }])->whereHas('student', function ($query) { |
|
82 | + }])->whereHas('student', function($query) { |
|
83 | 83 | $query->where('gender_id', '=', 2); |
84 | 84 | })->where('institution_class_id', '=', $institution_class_id)->count(); |
85 | 85 | |
@@ -109,8 +109,8 @@ discard block |
||
109 | 109 | ->where('student_id', $student['student_id']) |
110 | 110 | ->join('institution_classes', 'institution_class_students.institution_class_id', '=', 'institution_classes.id') |
111 | 111 | ->where('institution_class_students.student_id', $student['student_id']) |
112 | - ->where('institution_class_students.academic_period_id',$student['academic_period_id']) |
|
113 | - ->where('institution_class_students.institution_id',$student['institution_id']) |
|
112 | + ->where('institution_class_students.academic_period_id', $student['academic_period_id']) |
|
113 | + ->where('institution_class_students.institution_id', $student['institution_id']) |
|
114 | 114 | ->whereNull('institution_class_students.deleted_at') |
115 | 115 | ->get()->first(); |
116 | 116 | } |
@@ -134,12 +134,12 @@ discard block |
||
134 | 134 | 'institution_id' => $admissionInfo['instituion']->id, |
135 | 135 | 'student_status_id' => 1 |
136 | 136 | ]); |
137 | - } catch (\Throwable $th) { |
|
137 | + }catch (\Throwable $th) { |
|
138 | 138 | Log::error($th); |
139 | 139 | } |
140 | 140 | } |
141 | 141 | |
142 | - public static function createOrUpdate($studentId,$params,$file){ |
|
142 | + public static function createOrUpdate($studentId, $params, $file) { |
|
143 | 143 | return self::create([ |
144 | 144 | 'student_id' => $studentId, |
145 | 145 | 'institution_class_id' => $params['institution_class']->id, |
@@ -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([]); |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | $row = $this->setGender($row); |
116 | 116 | $mandatorySubject = Institution_class_subject::getMandatorySubjects($this->file['institution_class_id']); |
117 | 117 | $subjects = getMatchingKeys($row); |
118 | - $student = Security_user::createOrUpdateStudentProfile($row,'create',$this->file); |
|
118 | + $student = Security_user::createOrUpdateStudentProfile($row, 'create', $this->file); |
|
119 | 119 | $academicPeriod = Academic_period::where('id', '=', $institutionClass->academic_period_id)->first(); |
120 | 120 | $institutionGrade = Institution_class_grade::where('institution_class_id', '=', $institutionClass->id)->first(); |
121 | 121 | $assignee_id = $institutionClass->staff_id ? $institutionClass->staff_id : $this->file['security_user_id']; |
@@ -128,24 +128,24 @@ discard block |
||
128 | 128 | 'institution_class' => $institutionClass |
129 | 129 | ]; |
130 | 130 | |
131 | - Institution_student_admission::createAdmission($student->id,$row,$params,$this->file); |
|
132 | - Institution_student::createOrUpdate($student->id,$row,$params,$this->file); |
|
133 | - $student = Institution_class_student::createOrUpdate($student->id,$params,$this->file); |
|
134 | - User_special_need::createOrUpdate($student->student_id,$row,$this->file); |
|
135 | - User_body_mass::createOrUpdate($student->student_id,$row,$this->file); |
|
131 | + Institution_student_admission::createAdmission($student->id, $row, $params, $this->file); |
|
132 | + Institution_student::createOrUpdate($student->id, $row, $params, $this->file); |
|
133 | + $student = Institution_class_student::createOrUpdate($student->id, $params, $this->file); |
|
134 | + User_special_need::createOrUpdate($student->student_id, $row, $this->file); |
|
135 | + User_body_mass::createOrUpdate($student->student_id, $row, $this->file); |
|
136 | 136 | |
137 | - $this->createOrUpdateGuardian($row,$student,'father'); |
|
138 | - $this->createOrUpdateGuardian($row,$student,'mother'); |
|
139 | - $this->createOrUpdateGuardian($row,$student,'guardian'); |
|
137 | + $this->createOrUpdateGuardian($row, $student, 'father'); |
|
138 | + $this->createOrUpdateGuardian($row, $student, 'mother'); |
|
139 | + $this->createOrUpdateGuardian($row, $student, 'guardian'); |
|
140 | 140 | |
141 | 141 | Institution_student::updateStudentArea($student->toArray()); |
142 | 142 | |
143 | - $this->insertOrUpdateSubjects($row,$student,$institution); |
|
143 | + $this->insertOrUpdateSubjects($row, $student, $institution); |
|
144 | 144 | |
145 | 145 | $totalStudents = Institution_class_student::getStudentsCount($this->file['institution_class_id']); |
146 | 146 | if ($totalStudents['total'] > $institutionClass->no_of_students) { |
147 | 147 | $error = \Illuminate\Validation\ValidationException::withMessages([]); |
148 | - $failure = new Failure(3, 'rows', [3 => 'Class student count exceeded! Max number of students is ' . $institutionClass->no_of_students], [null]); |
|
148 | + $failure = new Failure(3, 'rows', [3 => 'Class student count exceeded! Max number of students is '.$institutionClass->no_of_students], [null]); |
|
149 | 149 | $failures = [0 => $failure]; |
150 | 150 | throw new \Maatwebsite\Excel\Validators\ValidationException($error, $failures); |
151 | 151 | Log::info('email-sent', [$this->file]); |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | $institutionClass = new Institution_class(); |
155 | 155 | $institutionClass->updateClassCount($this->file); |
156 | 156 | } |
157 | - } catch (\Maatwebsite\Excel\Validators\ValidationException $e) { |
|
157 | + }catch (\Maatwebsite\Excel\Validators\ValidationException $e) { |
|
158 | 158 | $error = \Illuminate\Validation\ValidationException::withMessages([]); |
159 | 159 | $failures = $e->failures(); |
160 | 160 | throw new \Maatwebsite\Excel\Validators\ValidationException($error, $failures); |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | '*.full_name' => 'required|regex:/^[a-zA-Z .]*$/u|max:256', |
170 | 170 | '*.preferred_name' => 'nullable|regex:/^[a-zA-Z .]*$/u|max:90', |
171 | 171 | '*.gender_mf' => 'required|in:M,F', |
172 | - '*.date_of_birth_yyyy_mm_dd' => 'date|required|admission_age:' . $this->file['institution_class_id'], |
|
172 | + '*.date_of_birth_yyyy_mm_dd' => 'date|required|admission_age:'.$this->file['institution_class_id'], |
|
173 | 173 | '*.address' => 'nullable', |
174 | 174 | '*.birth_registrar_office_as_in_birth_certificate' => 'nullable|exists:area_administratives,name|required_if:identity_type,BC|birth_place', |
175 | 175 | '*.birth_divisional_secretariat' => 'nullable|exists:area_administratives,name|required_with:birth_registrar_office_as_in_birth_certificate', |
@@ -178,8 +178,8 @@ discard block |
||
178 | 178 | '*.identity_number' => 'nullable|identity:identity_type|required_with:*.identity_type', |
179 | 179 | '*.education_grade' => 'required', |
180 | 180 | '*.option_*' => 'nullable|exists:education_subjects,name', |
181 | - '*.bmi_height' => 'bail|required_with:*.bmi_weight|bmi:' . $this->file['institution_class_id'], |
|
182 | - '*.bmi_weight' => 'bail|required_with:*.bmi_height|bmi:' . $this->file['institution_class_id'], |
|
181 | + '*.bmi_height' => 'bail|required_with:*.bmi_weight|bmi:'.$this->file['institution_class_id'], |
|
182 | + '*.bmi_weight' => 'bail|required_with:*.bmi_height|bmi:'.$this->file['institution_class_id'], |
|
183 | 183 | '*.bmi_date_yyyy_mm_dd' => 'bail|required_with:*.bmi_height|date', //bmi:'. $this->file['institution_class_id'].' |
184 | 184 | '*.bmi_academic_period' => 'bail|required_with:*.bmi_height|exists:academic_periods,name', |
185 | 185 | '*.admission_no' => 'required|max:12|min:4|regex:/^[A-Za-z0-9\/]+$/', |
@@ -71,17 +71,17 @@ discard block |
||
71 | 71 | if (empty($value)) { |
72 | 72 | return false; |
73 | 73 | } elseif ($gradeEntity !== null) { |
74 | - $admissionAge = (($gradeEntity->admission_age) * 12) - 1; |
|
74 | + $admissionAge = (($gradeEntity->admission_age)*12) - 1; |
|
75 | 75 | $to = $academicPeriod->start_date; |
76 | 76 | $diff_in_months = $to->diffInMonths($value); |
77 | 77 | $ageOfStudent = $diff_in_months; |
78 | 78 | $enrolmentMaximumAge = $admissionAge + 120; |
79 | 79 | return ($ageOfStudent <= $enrolmentMaximumAge) && ($ageOfStudent >= $admissionAge); |
80 | - } else { |
|
80 | + }else { |
|
81 | 81 | return false; |
82 | 82 | } |
83 | - } else { |
|
84 | - $this->_custom_messages['admission_age'] = 'given' . $attribute . 'Not found'; |
|
83 | + }else { |
|
84 | + $this->_custom_messages['admission_age'] = 'given'.$attribute.'Not found'; |
|
85 | 85 | $this->_set_custom_stuff(); |
86 | 86 | return false; |
87 | 87 | } |
@@ -92,16 +92,16 @@ discard block |
||
92 | 92 | |
93 | 93 | if (is_numeric($value)) { |
94 | 94 | if ($value < 10) { |
95 | - $this->_custom_messages['bmi'] = $attribute . ' is must greater than 10'; |
|
95 | + $this->_custom_messages['bmi'] = $attribute.' is must greater than 10'; |
|
96 | 96 | $this->_set_custom_stuff(); |
97 | 97 | return false; |
98 | 98 | } elseif ($value > 250) { |
99 | - $this->_custom_messages['bmi'] = $attribute . ' is must smaller than 250'; |
|
99 | + $this->_custom_messages['bmi'] = $attribute.' is must smaller than 250'; |
|
100 | 100 | $this->_set_custom_stuff(); |
101 | 101 | return false; |
102 | 102 | } |
103 | - } else { |
|
104 | - $this->_custom_messages['bmi'] = $attribute . ' is must a valid numeric'; |
|
103 | + }else { |
|
104 | + $this->_custom_messages['bmi'] = $attribute.' is must a valid numeric'; |
|
105 | 105 | $this->_set_custom_stuff(); |
106 | 106 | return false; |
107 | 107 | } |
@@ -110,18 +110,18 @@ discard block |
||
110 | 110 | |
111 | 111 | protected function validateBmi($attribute, $value, $parameters) |
112 | 112 | { |
113 | - $bmiGrades = ['G1', 'G4', 'G7', 'G10']; |
|
113 | + $bmiGrades = ['G1', 'G4', 'G7', 'G10']; |
|
114 | 114 | $institutionGrade = Institution_class_grade::where('institution_class_id', '=', $parameters[0]) |
115 | 115 | ->join('education_grades', 'institution_class_grades.education_grade_id', 'education_grades.id') |
116 | 116 | ->first(); |
117 | - $educationGrade = Education_grade::where('id', '=', $institutionGrade->education_grade_id)->first(); |
|
117 | + $educationGrade = Education_grade::where('id', '=', $institutionGrade->education_grade_id)->first(); |
|
118 | 118 | if (in_array($institutionGrade->code, $bmiGrades)) { |
119 | 119 | if (!empty($value)) { |
120 | 120 | if (($attribute == 'bmi_height') || ('bmi_weight')) { |
121 | 121 | return $this->validateHW($attribute, $value); |
122 | 122 | } |
123 | - } else { |
|
124 | - $this->_custom_messages['bmi'] = $attribute . ' is required for ' . $educationGrade->name; |
|
123 | + }else { |
|
124 | + $this->_custom_messages['bmi'] = $attribute.' is required for '.$educationGrade->name; |
|
125 | 125 | $this->_set_custom_stuff(); |
126 | 126 | return false; |
127 | 127 | } |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | if (($attribute == 'bmi_height') || ('bmi_weight')) { |
130 | 130 | return $this->validateHW($attribute, $value); |
131 | 131 | } |
132 | - } else { |
|
132 | + }else { |
|
133 | 133 | return true; |
134 | 134 | } |
135 | 135 | } |
@@ -138,19 +138,19 @@ discard block |
||
138 | 138 | { |
139 | 139 | foreach ($validator->getData() as $data) { |
140 | 140 | if ($data['identity_type'] == 'BC' && key_exists('birth_divisional_secretariat', $data)) { |
141 | - $BirthDivision = Area_administrative::where('name', '=', '%' . $data['birth_divisional_secretariat'] . '%')->where('area_administrative_level_id', '=', 5); // |
|
141 | + $BirthDivision = Area_administrative::where('name', '=', '%'.$data['birth_divisional_secretariat'].'%')->where('area_administrative_level_id', '=', 5); // |
|
142 | 142 | if ($BirthDivision->count() > 0) { |
143 | - $BirthArea = Area_administrative::where('name', '=', '%' . $value . '%') //$data['birth_registrar_office_as_in_birth_certificate'] |
|
143 | + $BirthArea = Area_administrative::where('name', '=', '%'.$value.'%') //$data['birth_registrar_office_as_in_birth_certificate'] |
|
144 | 144 | ->where('parent_id', '=', $BirthDivision->first()->id)->count(); |
145 | - return $BirthArea > 0; |
|
145 | + return $BirthArea > 0; |
|
146 | 146 | } elseif (key_exists('birth_divisional_secretariat', $data) && (!key_exists('birth_registrar_office_as_in_birth_certificate', $data))) { |
147 | 147 | $this->_custom_messages['birth_place'] = 'birth_registrar_office_as_in_birth_certificate required with BC'; |
148 | 148 | $this->_set_custom_stuff(); |
149 | 149 | return false; |
150 | - } else { |
|
150 | + }else { |
|
151 | 151 | return true; |
152 | 152 | } |
153 | - } else { |
|
153 | + }else { |
|
154 | 154 | return true; |
155 | 155 | } |
156 | 156 | } |
@@ -158,16 +158,16 @@ discard block |
||
158 | 158 | |
159 | 159 | protected function validateIsStudentInClass($attribute, $value, $perameters, $validator) |
160 | 160 | { |
161 | - $student = Security_user::where('openemis_no', '=', $value); |
|
161 | + $student = Security_user::where('openemis_no', '=', $value); |
|
162 | 162 | if ($student->count() > 0) { |
163 | 163 | $student = $student->first()->toArray(); |
164 | - $check = Institution_class_student::where('student_id', '=', $student['id'])->where('institution_class_id', '=', $perameters[0])->count(); |
|
164 | + $check = Institution_class_student::where('student_id', '=', $student['id'])->where('institution_class_id', '=', $perameters[0])->count(); |
|
165 | 165 | if ($check == 1) { |
166 | 166 | return true; |
167 | - } else { |
|
167 | + }else { |
|
168 | 168 | return false; |
169 | 169 | } |
170 | - } else { |
|
170 | + }else { |
|
171 | 171 | return false; |
172 | 172 | } |
173 | 173 | } |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | { |
179 | 179 | $valid = true; |
180 | 180 | foreach ($validator->getData() as $data) { |
181 | - switch($data[$perameters[0]]){ |
|
181 | + switch ($data[$perameters[0]]) { |
|
182 | 182 | case 'BC': |
183 | 183 | $valid = preg_match('/^([0-9]{3,5})$/i', $value); |
184 | 184 | break; |
@@ -191,10 +191,10 @@ discard block |
||
191 | 191 | } |
192 | 192 | |
193 | 193 | if (!$valid) { |
194 | - $this->_custom_messages['nic'] = $attribute . ' is not valid, Please check the NIC number'; |
|
194 | + $this->_custom_messages['nic'] = $attribute.' is not valid, Please check the NIC number'; |
|
195 | 195 | $this->_set_custom_stuff(); |
196 | 196 | return false; |
197 | - } else { |
|
197 | + }else { |
|
198 | 198 | return true; |
199 | 199 | } |
200 | 200 | } |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | protected function validateUserUnique($attribute, $value, $perameters, $validator) |
203 | 203 | { |
204 | 204 | foreach ($validator->getData() as $data) { |
205 | - $identityType = Identity_type::where('national_code', 'like', '%' . $data['identity_type'] . '%')->first(); |
|
205 | + $identityType = Identity_type::where('national_code', 'like', '%'.$data['identity_type'].'%')->first(); |
|
206 | 206 | if ($identityType !== null && ($value !== null)) { |
207 | 207 | if ($identityType->national_code === 'BC') { |
208 | 208 | return $this->checkUnique($value, $data, $identityType); |
@@ -218,14 +218,14 @@ discard block |
||
218 | 218 | protected function validateIsBc($attribute, $value, $perameters, $validator) |
219 | 219 | { |
220 | 220 | foreach ($validator->getData() as $data) { |
221 | - $identityType = Identity_type::where('national_code', 'like', '%' . $data['identity_type'] . '%')->first(); |
|
221 | + $identityType = Identity_type::where('national_code', 'like', '%'.$data['identity_type'].'%')->first(); |
|
222 | 222 | if (($identityType !== null) && ($identityType !== "")) { |
223 | 223 | if (($identityType->national_code) === 'BC') { |
224 | 224 | return (strlen((string) $data['identity_number']) < 7); |
225 | - } else { |
|
225 | + }else { |
|
226 | 226 | return true; |
227 | 227 | } |
228 | - } else { |
|
228 | + }else { |
|
229 | 229 | return true; |
230 | 230 | } |
231 | 231 | } |
@@ -235,24 +235,24 @@ discard block |
||
235 | 235 | { |
236 | 236 | $isUnique = Security_user::where('identity_number', '=', $value)->where('identity_type_id', '=', $identityType->id); |
237 | 237 | if ($isUnique->count() > 0) { |
238 | - $this->_custom_messages['user_unique'] = 'The identity number already in use. User ID is : ' . $isUnique->first()->openemis_no; |
|
238 | + $this->_custom_messages['user_unique'] = 'The identity number already in use. User ID is : '.$isUnique->first()->openemis_no; |
|
239 | 239 | $this->_set_custom_stuff(); |
240 | 240 | return false; |
241 | - } else { |
|
241 | + }else { |
|
242 | 242 | return true; |
243 | 243 | } |
244 | 244 | } |
245 | 245 | |
246 | 246 | protected function IsBc($data, $value) |
247 | 247 | { |
248 | - $identityType = Identity_type::where('national_code', 'like', '%' . $data['identity_type'] . '%')->first(); |
|
248 | + $identityType = Identity_type::where('national_code', 'like', '%'.$data['identity_type'].'%')->first(); |
|
249 | 249 | if ($identityType !== null) { |
250 | 250 | if (($identityType->national_code) === 'BC' && strlen((string) $value) < 8) { |
251 | 251 | return false; |
252 | - } else { |
|
252 | + }else { |
|
253 | 253 | return true; |
254 | 254 | } |
255 | - } else { |
|
255 | + }else { |
|
256 | 256 | return true; |
257 | 257 | } |
258 | 258 | } |