@@ -228,26 +228,26 @@ |
||
228 | 228 | if(!is_null($father) && is_null($mother) && is_null($guardian)){ |
229 | 229 | Security_user::where('id',$student['student_id']) |
230 | 230 | ->update(['address_area_id' => $father->address_area_id]); |
231 | - }elseif(!is_null($mother) && (is_null($father) && is_null($guardian))){ |
|
231 | + } elseif(!is_null($mother) && (is_null($father) && is_null($guardian))){ |
|
232 | 232 | Security_user::where('id',$student['student_id']) |
233 | 233 | ->update(['address_area_id' => $mother->address_area_id]); |
234 | - }elseif(!is_null($guardian) && is_null($father) && is_null($mother)){ |
|
234 | + } elseif(!is_null($guardian) && is_null($father) && is_null($mother)){ |
|
235 | 235 | Security_user::where('id',$student['student_id']) |
236 | 236 | ->update(['address_area_id' => $guardian->address_area_id]); |
237 | - }elseif(!is_null($mother) && !is_null($father) && ($father->address_area_id == $mother->address_area_id)){ |
|
237 | + } elseif(!is_null($mother) && !is_null($father) && ($father->address_area_id == $mother->address_area_id)){ |
|
238 | 238 | // dd($father->address_area_id,$mother->address_area_id,$student['student_id']); |
239 | 239 | $d = Security_user::where('id',$student['student_id']) |
240 | 240 | ->update(['address_area_id' => $mother->address_area_id]); |
241 | - }elseif(!is_null($mother) && !is_null($father) && ($father->address_area_id !== $mother->address_area_id) && !is_null($guardian)){ |
|
241 | + } elseif(!is_null($mother) && !is_null($father) && ($father->address_area_id !== $mother->address_area_id) && !is_null($guardian)){ |
|
242 | 242 | Security_user::where('id',$student['student_id']) |
243 | 243 | ->update(['address_area_id' => $guardian->address_area_id]); |
244 | - }elseif(!is_null($father) && $father->address == $student['address']){ |
|
244 | + } elseif(!is_null($father) && $father->address == $student['address']){ |
|
245 | 245 | Security_user::where('id',$student['student_id']) |
246 | 246 | ->update(['address_area_id' => $guardian->address_area_id]); |
247 | - }elseif(!is_null($mother) && $mother->address == $student['address']){ |
|
247 | + } elseif(!is_null($mother) && $mother->address == $student['address']){ |
|
248 | 248 | Security_user::where('id',$student['student_id']) |
249 | 249 | ->update(['address_area_id' => $mother->address_area_id]); |
250 | - }elseif(!is_null($guardian) && $guardian->address == $student['address']){ |
|
250 | + } elseif(!is_null($guardian) && $guardian->address == $student['address']){ |
|
251 | 251 | Security_user::where('id',$student['student_id']) |
252 | 252 | ->update(['address_area_id' => $guardian->address_area_id]); |
253 | 253 | } |
@@ -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) |
@@ -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 | } |