@@ -70,10 +70,10 @@ discard block |
||
70 | 70 | public function getParallelClasses($id, $institutionId, $educationGradeId, $academicPeriodId) |
71 | 71 | { |
72 | 72 | $data = self::find($id)->select('institution_grades.id as insGrade', 'institution_classes.id', 'institution_classes.name', 'institution_grades.education_grade_id') |
73 | - ->join('institution_classes', function ($join) use ($educationGradeId, $academicPeriodId) { |
|
73 | + ->join('institution_classes', function($join) use ($educationGradeId, $academicPeriodId) { |
|
74 | 74 | $join->on('institution_classes.institution_id', '=', 'institution_grades.institution_id') |
75 | 75 | ->where('institution_classes.academic_period_id', $academicPeriodId) |
76 | - ->join('institution_class_grades', function ($join) use ($educationGradeId) { |
|
76 | + ->join('institution_class_grades', function($join) use ($educationGradeId) { |
|
77 | 77 | $join->on('institution_class_grades.institution_class_id', '=', 'institution_classes.id') |
78 | 78 | ->where('institution_class_grades.education_grade_id', $educationGradeId); |
79 | 79 | }) |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | ->select('education_grades.name', 'institutions.code', 'institutions.name as institution_name', 'institution_grades.id', 'institution_grades.institution_id', 'institution_grades.education_grade_id') |
124 | 124 | // ->where('promoted', '=', $year) |
125 | 125 | ->join('education_grades', 'institution_grades.education_grade_id', '=', 'education_grades.id') |
126 | - ->join('institutions', function ($join) use ($year, $institution) { |
|
126 | + ->join('institutions', function($join) use ($year, $institution) { |
|
127 | 127 | $join->on('institutions.id', '=', 'institution_grades.institution_id') |
128 | 128 | ->where('institutions.code', '=', $institution); |
129 | 129 | }) |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | break; |
135 | 135 | case '6-11': |
136 | 136 | $query->whereIn('education_programmes.education_cycle_id', [2, 3]); |
137 | - $query->whereNotIn('education_grades.id',[29,34]); |
|
137 | + $query->whereNotIn('education_grades.id', [29, 34]); |
|
138 | 138 | break; |
139 | 139 | case 'AL': |
140 | 140 | $query->where('education_programmes.education_cycle_id', 4); |
@@ -152,21 +152,21 @@ discard block |
||
152 | 152 | * @param $year |
153 | 153 | * @return mixed |
154 | 154 | */ |
155 | - public function getInstitutionGradeList($year, $limit,$mode) |
|
155 | + public function getInstitutionGradeList($year, $limit, $mode) |
|
156 | 156 | { |
157 | 157 | $query = $this->select('education_grades.name', 'institutions.code', 'institutions.name as institution_name', 'institution_grades.id', 'institution_grades.institution_id', 'institution_grades.education_grade_id') |
158 | 158 | // ->where('promoted', '=', $year) |
159 | 159 | ->join('education_grades', 'institution_grades.education_grade_id', '=', 'education_grades.id') |
160 | - ->join('institutions', function ($join) use ($year) { |
|
160 | + ->join('institutions', function($join) use ($year) { |
|
161 | 161 | $join->on('institutions.id', '=', 'institution_grades.institution_id'); |
162 | 162 | }) |
163 | 163 | ->join('education_programmes', 'education_grades.education_programme_id', 'education_programmes.id'); |
164 | 164 | switch ($mode) { |
165 | 165 | case '1-5': |
166 | - $query->whereIn('education_programmes.education_cycle_id', [1,2]); |
|
166 | + $query->whereIn('education_programmes.education_cycle_id', [1, 2]); |
|
167 | 167 | break; |
168 | 168 | case '6-11': |
169 | - $query->whereIn('education_programmes.education_cycle_id', [2,3,4]); |
|
169 | + $query->whereIn('education_programmes.education_cycle_id', [2, 3, 4]); |
|
170 | 170 | break; |
171 | 171 | case 'AL': |
172 | 172 | $query->where('education_programmes.education_cycle_id', 4); |
@@ -181,13 +181,13 @@ discard block |
||
181 | 181 | return $data; |
182 | 182 | } |
183 | 183 | |
184 | - public function getGradeSubjects($institutionId){ |
|
184 | + public function getGradeSubjects($institutionId) { |
|
185 | 185 | return self::query() |
186 | - ->select('institution_grades.institution_id','education_grades_subjects.education_grade_id','education_grades_subjects.education_subject_id','education_subjects.name') |
|
187 | - ->where('institution_grades.institution_id',$institutionId) |
|
186 | + ->select('institution_grades.institution_id', 'education_grades_subjects.education_grade_id', 'education_grades_subjects.education_subject_id', 'education_subjects.name') |
|
187 | + ->where('institution_grades.institution_id', $institutionId) |
|
188 | 188 | ->join('education_grades', 'institution_grades.education_grade_id', 'education_grades.id') |
189 | - ->join('education_grades_subjects','education_grades.id','education_grades_subjects.education_grade_id') |
|
190 | - ->join('education_subjects','education_grades_subjects.education_subject_id','education_subjects.id') |
|
189 | + ->join('education_grades_subjects', 'education_grades.id', 'education_grades_subjects.education_grade_id') |
|
190 | + ->join('education_subjects', 'education_grades_subjects.education_subject_id', 'education_subjects.id') |
|
191 | 191 | ->groupBy('education_grades_subjects.id') |
192 | 192 | ->get() |
193 | 193 | ->toArray(); |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | protected function ValidateIdentity($attribute, $value, $perameters, $validator) |
255 | 255 | |
256 | 256 | { |
257 | - // dd($value); |
|
257 | + // dd($value); |
|
258 | 258 | |
259 | 259 | foreach ($validator->getData() as $data) { |
260 | 260 | |
@@ -263,16 +263,16 @@ discard block |
||
263 | 263 | { |
264 | 264 | //dd(true); |
265 | 265 | |
266 | - if(!strcmp($data['identity_type'],"BC")) |
|
267 | - { |
|
266 | + if(!strcmp($data['identity_type'],"BC")) |
|
267 | + { |
|
268 | 268 | $out = 1; |
269 | - } |
|
270 | - else |
|
271 | - { |
|
272 | - $out = 2; |
|
273 | - } |
|
269 | + } |
|
270 | + else |
|
271 | + { |
|
272 | + $out = 2; |
|
273 | + } |
|
274 | 274 | |
275 | - if(($out == 1)&&(preg_match('/^[0-9]{4}+$/',$value))) |
|
275 | + if(($out == 1)&&(preg_match('/^[0-9]{4}+$/',$value))) |
|
276 | 276 | { |
277 | 277 | //dd(true); |
278 | 278 | return true; |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | } |
281 | 281 | |
282 | 282 | elseif (($out == 2) &&(preg_match('/^[0-9]{9}[VX]{1}+$/',$value))) |
283 | - { |
|
283 | + { |
|
284 | 284 | return true; |
285 | 285 | } |
286 | 286 | elseif (($out == 2) && (preg_match('/^[0-9]{12}+$/',$value))) |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | return true; |
289 | 289 | } |
290 | 290 | else { |
291 | - //dd(false); |
|
291 | + //dd(false); |
|
292 | 292 | $this ->_custom_messages['unmatch'] = $attribute." format does not match with Identity type"; |
293 | 293 | $this->_set_custom_stuff(); |
294 | 294 | return false; |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | } |
308 | 308 | |
309 | 309 | elseif (preg_match('/^[0-9]{9}[VX]{1}+$/',$value)) |
310 | - { |
|
310 | + { |
|
311 | 311 | return true; |
312 | 312 | } |
313 | 313 | elseif (preg_match('/^[0-9]{12}+$/',$value)) |
@@ -72,17 +72,17 @@ discard block |
||
72 | 72 | if (empty($value)) { |
73 | 73 | return false; |
74 | 74 | } elseif ($gradeEntity !== null) { |
75 | - $admissionAge = (($gradeEntity->admission_age) * 12) - 1; |
|
75 | + $admissionAge = (($gradeEntity->admission_age)*12) - 1; |
|
76 | 76 | $to = $academicPeriod->start_date; |
77 | 77 | $diff_in_months = $to->diffInMonths($value); |
78 | 78 | $ageOfStudent = $diff_in_months; |
79 | 79 | $enrolmentMaximumAge = $admissionAge + 120; |
80 | 80 | return ($ageOfStudent <= $enrolmentMaximumAge) && ($ageOfStudent >= $admissionAge); |
81 | - } else { |
|
81 | + }else { |
|
82 | 82 | return false; |
83 | 83 | } |
84 | - } else { |
|
85 | - $this->_custom_messages['admission_age'] = 'given' . $attribute . 'Not found'; |
|
84 | + }else { |
|
85 | + $this->_custom_messages['admission_age'] = 'given'.$attribute.'Not found'; |
|
86 | 86 | $this->_set_custom_stuff(); |
87 | 87 | return false; |
88 | 88 | } |
@@ -93,16 +93,16 @@ discard block |
||
93 | 93 | |
94 | 94 | if (is_numeric($value)) { |
95 | 95 | if ($value < 10) { |
96 | - $this->_custom_messages['bmi'] = $attribute . ' is must greater than 10'; |
|
96 | + $this->_custom_messages['bmi'] = $attribute.' is must greater than 10'; |
|
97 | 97 | $this->_set_custom_stuff(); |
98 | 98 | return false; |
99 | 99 | } elseif ($value > 250) { |
100 | - $this->_custom_messages['bmi'] = $attribute . ' is must smaller than 250'; |
|
100 | + $this->_custom_messages['bmi'] = $attribute.' is must smaller than 250'; |
|
101 | 101 | $this->_set_custom_stuff(); |
102 | 102 | return false; |
103 | 103 | } |
104 | - } else { |
|
105 | - $this->_custom_messages['bmi'] = $attribute . ' is must a valid numeric'; |
|
104 | + }else { |
|
105 | + $this->_custom_messages['bmi'] = $attribute.' is must a valid numeric'; |
|
106 | 106 | $this->_set_custom_stuff(); |
107 | 107 | return false; |
108 | 108 | } |
@@ -111,18 +111,18 @@ discard block |
||
111 | 111 | |
112 | 112 | protected function validateBmi($attribute, $value, $parameters) |
113 | 113 | { |
114 | - $bmiGrades = ['G1', 'G4', 'G7', 'G10']; |
|
114 | + $bmiGrades = ['G1', 'G4', 'G7', 'G10']; |
|
115 | 115 | $institutionGrade = Institution_class_grade::where('institution_class_id', '=', $parameters[0]) |
116 | 116 | ->join('education_grades', 'institution_class_grades.education_grade_id', 'education_grades.id') |
117 | 117 | ->first(); |
118 | - $educationGrade = Education_grade::where('id', '=', $institutionGrade->education_grade_id)->first(); |
|
118 | + $educationGrade = Education_grade::where('id', '=', $institutionGrade->education_grade_id)->first(); |
|
119 | 119 | if (in_array($institutionGrade->code, $bmiGrades)) { |
120 | 120 | if (!empty($value)) { |
121 | 121 | if (($attribute == 'bmi_height') || ('bmi_weight')) { |
122 | 122 | return $this->validateHW($attribute, $value); |
123 | 123 | } |
124 | - } else { |
|
125 | - $this->_custom_messages['bmi'] = $attribute . ' is required for ' . $educationGrade->name; |
|
124 | + }else { |
|
125 | + $this->_custom_messages['bmi'] = $attribute.' is required for '.$educationGrade->name; |
|
126 | 126 | $this->_set_custom_stuff(); |
127 | 127 | return false; |
128 | 128 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | if (($attribute == 'bmi_height') || ('bmi_weight')) { |
131 | 131 | return $this->validateHW($attribute, $value); |
132 | 132 | } |
133 | - } else { |
|
133 | + }else { |
|
134 | 134 | return true; |
135 | 135 | } |
136 | 136 | } |
@@ -139,19 +139,19 @@ discard block |
||
139 | 139 | { |
140 | 140 | foreach ($validator->getData() as $data) { |
141 | 141 | if ($data['identity_type'] == 'BC' && key_exists('birth_divisional_secretariat', $data)) { |
142 | - $BirthDivision = Area_administrative::where('name', '=', '%' . $data['birth_divisional_secretariat'] . '%')->where('area_administrative_level_id', '=', 5); // |
|
142 | + $BirthDivision = Area_administrative::where('name', '=', '%'.$data['birth_divisional_secretariat'].'%')->where('area_administrative_level_id', '=', 5); // |
|
143 | 143 | if ($BirthDivision->count() > 0) { |
144 | - $BirthArea = Area_administrative::where('name', '=', '%' . $value . '%') //$data['birth_registrar_office_as_in_birth_certificate'] |
|
144 | + $BirthArea = Area_administrative::where('name', '=', '%'.$value.'%') //$data['birth_registrar_office_as_in_birth_certificate'] |
|
145 | 145 | ->where('parent_id', '=', $BirthDivision->first()->id)->count(); |
146 | - return $BirthArea > 0; |
|
146 | + return $BirthArea > 0; |
|
147 | 147 | } elseif (key_exists('birth_divisional_secretariat', $data) && (!key_exists('birth_registrar_office_as_in_birth_certificate', $data))) { |
148 | 148 | $this->_custom_messages['birth_place'] = 'birth_registrar_office_as_in_birth_certificate required with BC'; |
149 | 149 | $this->_set_custom_stuff(); |
150 | 150 | return false; |
151 | - } else { |
|
151 | + }else { |
|
152 | 152 | return true; |
153 | 153 | } |
154 | - } else { |
|
154 | + }else { |
|
155 | 155 | return true; |
156 | 156 | } |
157 | 157 | } |
@@ -159,22 +159,22 @@ discard block |
||
159 | 159 | |
160 | 160 | protected function validateIsStudentInClass($attribute, $value, $perameters, $validator) |
161 | 161 | { |
162 | - $student = Security_user::where('openemis_no', '=', $value); |
|
162 | + $student = Security_user::where('openemis_no', '=', $value); |
|
163 | 163 | if ($student->count() > 0) { |
164 | 164 | $student = $student->first()->toArray(); |
165 | - $check = Institution_class_student::where('student_id', '=', $student['id'])->where('institution_class_id', '=', $perameters[0])->count(); |
|
165 | + $check = Institution_class_student::where('student_id', '=', $student['id'])->where('institution_class_id', '=', $perameters[0])->count(); |
|
166 | 166 | if ($check == 1) { |
167 | 167 | return true; |
168 | - } else { |
|
168 | + }else { |
|
169 | 169 | return false; |
170 | 170 | } |
171 | - } else { |
|
171 | + }else { |
|
172 | 172 | return false; |
173 | 173 | } |
174 | 174 | } |
175 | 175 | protected function validateNic($attribute, $value, $perameters, $validator) |
176 | 176 | { |
177 | - switch($data['identity_type']){ |
|
177 | + switch ($data['identity_type']) { |
|
178 | 178 | case 'BC': |
179 | 179 | //inclde the bc validation |
180 | 180 | break; |
@@ -184,10 +184,10 @@ discard block |
||
184 | 184 | } |
185 | 185 | $valid = preg_match('/^([0-9]{9}[VX]|[0-9]{12})$/i', $value); |
186 | 186 | if (!$valid) { |
187 | - $this->_custom_messages['nic'] = $attribute . ' is not valid, Please check the NIC number'; |
|
187 | + $this->_custom_messages['nic'] = $attribute.' is not valid, Please check the NIC number'; |
|
188 | 188 | $this->_set_custom_stuff(); |
189 | 189 | return false; |
190 | - } else { |
|
190 | + }else { |
|
191 | 191 | return true; |
192 | 192 | } |
193 | 193 | } |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | protected function validateUserUnique($attribute, $value, $perameters, $validator) |
196 | 196 | { |
197 | 197 | foreach ($validator->getData() as $data) { |
198 | - $identityType = Identity_type::where('national_code', 'like', '%' . $data['identity_type'] . '%')->first(); |
|
198 | + $identityType = Identity_type::where('national_code', 'like', '%'.$data['identity_type'].'%')->first(); |
|
199 | 199 | if ($identityType !== null && ($value !== null)) { |
200 | 200 | if ($identityType->national_code === 'BC') { |
201 | 201 | return $this->checkUnique($value, $data, $identityType); |
@@ -211,14 +211,14 @@ discard block |
||
211 | 211 | protected function validateIsBc($attribute, $value, $perameters, $validator) |
212 | 212 | { |
213 | 213 | foreach ($validator->getData() as $data) { |
214 | - $identityType = Identity_type::where('national_code', 'like', '%' . $data['identity_type'] . '%')->first(); |
|
214 | + $identityType = Identity_type::where('national_code', 'like', '%'.$data['identity_type'].'%')->first(); |
|
215 | 215 | if (($identityType !== null) && ($identityType !== "")) { |
216 | 216 | if (($identityType->national_code) === 'BC') { |
217 | 217 | return (strlen((string) $data['identity_number']) < 7); |
218 | - } else { |
|
218 | + }else { |
|
219 | 219 | return true; |
220 | 220 | } |
221 | - } else { |
|
221 | + }else { |
|
222 | 222 | return true; |
223 | 223 | } |
224 | 224 | } |
@@ -228,24 +228,24 @@ discard block |
||
228 | 228 | { |
229 | 229 | $isUnique = Security_user::where('identity_number', '=', $value)->where('identity_type_id', '=', $identityType->id); |
230 | 230 | if ($isUnique->count() > 0) { |
231 | - $this->_custom_messages['user_unique'] = 'The identity number already in use. User ID is : ' . $isUnique->first()->openemis_no; |
|
231 | + $this->_custom_messages['user_unique'] = 'The identity number already in use. User ID is : '.$isUnique->first()->openemis_no; |
|
232 | 232 | $this->_set_custom_stuff(); |
233 | 233 | return false; |
234 | - } else { |
|
234 | + }else { |
|
235 | 235 | return true; |
236 | 236 | } |
237 | 237 | } |
238 | 238 | |
239 | 239 | protected function IsBc($data, $value) |
240 | 240 | { |
241 | - $identityType = Identity_type::where('national_code', 'like', '%' . $data['identity_type'] . '%')->first(); |
|
241 | + $identityType = Identity_type::where('national_code', 'like', '%'.$data['identity_type'].'%')->first(); |
|
242 | 242 | if ($identityType !== null) { |
243 | 243 | if (($identityType->national_code) === 'BC' && strlen((string) $value) < 8) { |
244 | 244 | return false; |
245 | - } else { |
|
245 | + }else { |
|
246 | 246 | return true; |
247 | 247 | } |
248 | - } else { |
|
248 | + }else { |
|
249 | 249 | return true; |
250 | 250 | } |
251 | 251 | } |
@@ -259,11 +259,11 @@ discard block |
||
259 | 259 | foreach ($validator->getData() as $data) { |
260 | 260 | |
261 | 261 | |
262 | - if(($data['identity_type'] != null)&&($value != null)) |
|
262 | + if (($data['identity_type'] != null) && ($value != null)) |
|
263 | 263 | { |
264 | 264 | //dd(true); |
265 | 265 | |
266 | - if(!strcmp($data['identity_type'],"BC")) |
|
266 | + if (!strcmp($data['identity_type'], "BC")) |
|
267 | 267 | { |
268 | 268 | $out = 1; |
269 | 269 | } |
@@ -272,18 +272,18 @@ discard block |
||
272 | 272 | $out = 2; |
273 | 273 | } |
274 | 274 | |
275 | - if(($out == 1)&&(preg_match('/^[0-9]{4}+$/',$value))) |
|
275 | + if (($out == 1) && (preg_match('/^[0-9]{4}+$/', $value))) |
|
276 | 276 | { |
277 | 277 | //dd(true); |
278 | 278 | return true; |
279 | 279 | |
280 | 280 | } |
281 | 281 | |
282 | - elseif (($out == 2) &&(preg_match('/^[0-9]{9}[VX]{1}+$/',$value))) |
|
282 | + elseif (($out == 2) && (preg_match('/^[0-9]{9}[VX]{1}+$/', $value))) |
|
283 | 283 | { |
284 | 284 | return true; |
285 | 285 | } |
286 | - elseif (($out == 2) && (preg_match('/^[0-9]{12}+$/',$value))) |
|
286 | + elseif (($out == 2) && (preg_match('/^[0-9]{12}+$/', $value))) |
|
287 | 287 | { |
288 | 288 | return true; |
289 | 289 | } |
@@ -295,22 +295,22 @@ discard block |
||
295 | 295 | |
296 | 296 | } |
297 | 297 | } |
298 | - else if(($data['identity_type'] != null)&&($value == null)){ |
|
298 | + else if (($data['identity_type'] != null) && ($value == null)) { |
|
299 | 299 | return true; |
300 | 300 | } |
301 | 301 | else { |
302 | - if(preg_match('/^[0-9]{4}+$/',$value)) |
|
302 | + if (preg_match('/^[0-9]{4}+$/', $value)) |
|
303 | 303 | { |
304 | 304 | //dd(true); |
305 | 305 | return true; |
306 | 306 | |
307 | 307 | } |
308 | 308 | |
309 | - elseif (preg_match('/^[0-9]{9}[VX]{1}+$/',$value)) |
|
309 | + elseif (preg_match('/^[0-9]{9}[VX]{1}+$/', $value)) |
|
310 | 310 | { |
311 | 311 | return true; |
312 | 312 | } |
313 | - elseif (preg_match('/^[0-9]{12}+$/',$value)) |
|
313 | + elseif (preg_match('/^[0-9]{12}+$/', $value)) |
|
314 | 314 | { |
315 | 315 | return true; |
316 | 316 | } |
@@ -266,8 +266,7 @@ discard block |
||
266 | 266 | if(!strcmp($data['identity_type'],"BC")) |
267 | 267 | { |
268 | 268 | $out = 1; |
269 | - } |
|
270 | - else |
|
269 | + } else |
|
271 | 270 | { |
272 | 271 | $out = 2; |
273 | 272 | } |
@@ -277,44 +276,34 @@ discard block |
||
277 | 276 | //dd(true); |
278 | 277 | return true; |
279 | 278 | |
280 | - } |
|
281 | - |
|
282 | - elseif (($out == 2) &&(preg_match('/^[0-9]{9}[VX]{1}+$/',$value))) |
|
279 | + } elseif (($out == 2) &&(preg_match('/^[0-9]{9}[VX]{1}+$/',$value))) |
|
283 | 280 | { |
284 | 281 | return true; |
285 | - } |
|
286 | - elseif (($out == 2) && (preg_match('/^[0-9]{12}+$/',$value))) |
|
282 | + } elseif (($out == 2) && (preg_match('/^[0-9]{12}+$/',$value))) |
|
287 | 283 | { |
288 | 284 | return true; |
289 | - } |
|
290 | - else { |
|
285 | + } else { |
|
291 | 286 | //dd(false); |
292 | 287 | $this ->_custom_messages['unmatch'] = $attribute." format does not match with Identity type"; |
293 | 288 | $this->_set_custom_stuff(); |
294 | 289 | return false; |
295 | 290 | |
296 | 291 | } |
297 | - } |
|
298 | - else if(($data['identity_type'] != null)&&($value == null)){ |
|
292 | + } else if(($data['identity_type'] != null)&&($value == null)){ |
|
299 | 293 | return true; |
300 | - } |
|
301 | - else { |
|
294 | + } else { |
|
302 | 295 | if(preg_match('/^[0-9]{4}+$/',$value)) |
303 | 296 | { |
304 | 297 | //dd(true); |
305 | 298 | return true; |
306 | 299 | |
307 | - } |
|
308 | - |
|
309 | - elseif (preg_match('/^[0-9]{9}[VX]{1}+$/',$value)) |
|
300 | + } elseif (preg_match('/^[0-9]{9}[VX]{1}+$/',$value)) |
|
310 | 301 | { |
311 | 302 | return true; |
312 | - } |
|
313 | - elseif (preg_match('/^[0-9]{12}+$/',$value)) |
|
303 | + } elseif (preg_match('/^[0-9]{12}+$/',$value)) |
|
314 | 304 | { |
315 | 305 | return true; |
316 | - } |
|
317 | - else { |
|
306 | + } else { |
|
318 | 307 | $this ->_custom_messages['idnum'] = $attribute." format is invalild"; |
319 | 308 | $this->_set_custom_stuff(); |
320 | 309 | return false; |
@@ -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 |