@@ -73,7 +73,7 @@ |
||
| 73 | 73 | try { |
| 74 | 74 | $files = Storage::disk('sis-bulk-data-files')->allFiles(); |
| 75 | 75 | Excel::import($import, request()->file('import_file')); |
| 76 | - }catch (\Maatwebsite\Excel\Validators\ValidationException $e) { |
|
| 76 | + } catch (\Maatwebsite\Excel\Validators\ValidationException $e) { |
|
| 77 | 77 | $failures = $e->failures(); |
| 78 | 78 | |
| 79 | 79 | foreach ($failures as $failure) { |
@@ -18,9 +18,9 @@ |
||
| 18 | 18 | // dd($request->user()->permissions); |
| 19 | 19 | if ($request->user() && (!($request->user()->permissions->isEmpty())) && $request->user()->permissions[0]->roles && $request->user()->permissions[0]->roles->code === 'HOMEROOM_TEACHER') { |
| 20 | 20 | return $next($request); |
| 21 | - }elseif ($request->user() && (!($request->user()->principal->isEmpty())) && $request->user()->principal[0]->roles && $request->user()->principal[0]->roles->code === 'PRINCIPAL') { |
|
| 21 | + } elseif ($request->user() && (!($request->user()->principal->isEmpty())) && $request->user()->principal[0]->roles && $request->user()->principal[0]->roles->code === 'PRINCIPAL') { |
|
| 22 | 22 | return $next($request); |
| 23 | - }elseif ($request->user() && (!($request->user()->zonal_cordinator->isEmpty())) && $request->user()->zonal_cordinator[0]->roles && $request->user()->zonal_cordinator[0]->roles->code === 'PRINCIPAL') { |
|
| 23 | + } elseif ($request->user() && (!($request->user()->zonal_cordinator->isEmpty())) && $request->user()->zonal_cordinator[0]->roles && $request->user()->zonal_cordinator[0]->roles->code === 'PRINCIPAL') { |
|
| 24 | 24 | return $next($request); |
| 25 | 25 | } |
| 26 | 26 | return redirect('/login')->with('status', 'Your dont have access for upload data. Please get assign your to the class and try'); |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | $rowData = $this->worksheet->rangeToArray('A'.$row.':'.$highestColumn.$row, NULL, TRUE, FALSE); |
| 88 | 88 | if (isEmptyRow(reset($rowData))) { |
| 89 | 89 | continue; |
| 90 | - }else { |
|
| 90 | + } else { |
|
| 91 | 91 | $higestRow += 1; |
| 92 | 92 | } |
| 93 | 93 | } |
@@ -114,13 +114,13 @@ discard block |
||
| 114 | 114 | $rowData = $this->worksheet->rangeToArray('A'.$row.':'.$highestColumn.$row, NULL, TRUE, FALSE); |
| 115 | 115 | if (isEmptyRow(reset($rowData))) { |
| 116 | 116 | continue; |
| 117 | - }else { |
|
| 117 | + } else { |
|
| 118 | 118 | $higestRow += 1; |
| 119 | 119 | } |
| 120 | 120 | } |
| 121 | 121 | if ($higestRow == 0) { |
| 122 | 122 | exit; |
| 123 | - }else { |
|
| 123 | + } else { |
|
| 124 | 124 | return $higestRow; |
| 125 | 125 | } |
| 126 | 126 | } |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | } |
| 151 | 151 | } |
| 152 | 152 | return $row; |
| 153 | - }catch (Exception $e) { |
|
| 153 | + } catch (Exception $e) { |
|
| 154 | 154 | $error = \Illuminate\Validation\ValidationException::withMessages([]); |
| 155 | 155 | $failure = new Failure(3, 'remark', [0 => 'Template is not valid for upload, use the template given in the system'], [null]); |
| 156 | 156 | $failures = [0 => $failure]; |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | protected function checkKeys($key,$count,$row){ |
| 197 | 197 | if(array_key_exists($key,$row)){ |
| 198 | 198 | return true; |
| 199 | - }else{ |
|
| 199 | + } else{ |
|
| 200 | 200 | $error = \Illuminate\Validation\ValidationException::withMessages([]); |
| 201 | 201 | $failure = new Failure($count, 'remark', [0 => 'Template is not valid for upload, use the template given in the system'. $key ,' Is missing form the template'], [null]); |
| 202 | 202 | $failures = [0 => $failure]; |
@@ -243,10 +243,10 @@ discard block |
||
| 243 | 243 | $failures = [0 => $failure]; |
| 244 | 244 | throw new \Maatwebsite\Excel\Validators\ValidationException($error, $failures); |
| 245 | 245 | Log::info('email-sent', [$this->file]); |
| 246 | - }catch (Exception $e) { |
|
| 246 | + } catch (Exception $e) { |
|
| 247 | 247 | Log::info('email-sending-failed', [$e]); |
| 248 | 248 | } |
| 249 | - }else { |
|
| 249 | + } else { |
|
| 250 | 250 | return true; |
| 251 | 251 | } |
| 252 | 252 | } |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | User_contact::createOrUpdate($father, $this->file['security_user_id']); |
| 299 | 299 | } |
| 300 | 300 | Student_guardian::createStudentGuardian($student, $father, $this->file['security_user_id']); |
| 301 | - }else { |
|
| 301 | + } else { |
|
| 302 | 302 | Security_user::where('id', '=', $father->id) |
| 303 | 303 | ->update(['is_guardian' => 1]); |
| 304 | 304 | $father['guardian_relation_id'] = 1; |
@@ -358,7 +358,7 @@ discard block |
||
| 358 | 358 | User_contact::createOrUpdate($mother, $this->file['security_user_id']); |
| 359 | 359 | } |
| 360 | 360 | Student_guardian::createStudentGuardian($student, $mother, $this->file['security_user_id']); |
| 361 | - }else { |
|
| 361 | + } else { |
|
| 362 | 362 | Security_user::where('id', '=', $mother->id) |
| 363 | 363 | ->update(['is_guardian' => 1]); |
| 364 | 364 | $mother['guardian_relation_id'] = 2; |
@@ -420,7 +420,7 @@ discard block |
||
| 420 | 420 | User_contact::createOrUpdate($guardian, $this->file['security_user_id']); |
| 421 | 421 | } |
| 422 | 422 | Student_guardian::createStudentGuardian($student, $guardian, $this->file['security_user_id']); |
| 423 | - }else { |
|
| 423 | + } else { |
|
| 424 | 424 | Security_user::where('id', '=', $guardian->id) |
| 425 | 425 | ->update(['is_guardian' => 1]); |
| 426 | 426 | $guardian['guardian_relation_id'] = 3; |
@@ -465,7 +465,7 @@ discard block |
||
| 465 | 465 | 'total_male_students' => $totalStudents['total_male_students'], |
| 466 | 466 | 'total_female_students' => $totalStudents['total_female_students']]); |
| 467 | 467 | } |
| 468 | - }catch (\Maatwebsite\Excel\Validators\ValidationException $e) { |
|
| 468 | + } catch (\Maatwebsite\Excel\Validators\ValidationException $e) { |
|
| 469 | 469 | $error = \Illuminate\Validation\ValidationException::withMessages([]); |
| 470 | 470 | // $failure = new Failure(3, 'remark', [3 => ], [null]); |
| 471 | 471 | $failures = $e->failures(); |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | User_contact::createOrUpdate($father, $this->file['security_user_id']); |
| 257 | 257 | } |
| 258 | 258 | Student_guardian::createStudentGuardian($student, $father, $this->file['security_user_id']); |
| 259 | - }else { |
|
| 259 | + } else { |
|
| 260 | 260 | Security_user::where('id', '=', $father->id) |
| 261 | 261 | ->update(['is_guardian' => 1]); |
| 262 | 262 | $father['guardian_relation_id'] = 1; |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | User_contact::createOrUpdate($mother, $this->file['security_user_id']); |
| 308 | 308 | } |
| 309 | 309 | Student_guardian::createStudentGuardian($student, $mother, $this->file['security_user_id']); |
| 310 | - }else { |
|
| 310 | + } else { |
|
| 311 | 311 | Security_user::where('id', '=', $mother->id) |
| 312 | 312 | ->update(['is_guardian' => 1]); |
| 313 | 313 | $mother['guardian_relation_id'] = 2; |
@@ -361,7 +361,7 @@ discard block |
||
| 361 | 361 | User_contact::createOrUpdate($guardian, $this->file['security_user_id']); |
| 362 | 362 | } |
| 363 | 363 | Student_guardian::createStudentGuardian($student, $guardian, $this->file['security_user_id']); |
| 364 | - }else { |
|
| 364 | + } else { |
|
| 365 | 365 | Security_user::where('id', '=', $guardian->id) |
| 366 | 366 | ->update(['is_guardian' => 1]); |
| 367 | 367 | $guardian['guardian_relation_id'] = 3; |
@@ -408,7 +408,7 @@ discard block |
||
| 408 | 408 | 'total_male_students' => $totalStudents['total_male_students'], |
| 409 | 409 | 'total_female_students' => $totalStudents['total_female_students']]); |
| 410 | 410 | } |
| 411 | - }catch (\Maatwebsite\Excel\Validators\ValidationException $e) { |
|
| 411 | + } catch (\Maatwebsite\Excel\Validators\ValidationException $e) { |
|
| 412 | 412 | $error = \Illuminate\Validation\ValidationException::withMessages([]); |
| 413 | 413 | $failures = $e->failures(); |
| 414 | 414 | throw new \Maatwebsite\Excel\Validators\ValidationException($error, $failures); |
@@ -423,8 +423,9 @@ discard block |
||
| 423 | 423 | } |
| 424 | 424 | |
| 425 | 425 | protected function insertSubject($subject) { |
| 426 | - if (!Institution_subject_student::isDuplicated($subject)) |
|
| 427 | - Institution_subject_student::updateOrInsert($subject); |
|
| 426 | + if (!Institution_subject_student::isDuplicated($subject)) { |
|
| 427 | + Institution_subject_student::updateOrInsert($subject); |
|
| 428 | + } |
|
| 428 | 429 | } |
| 429 | 430 | |
| 430 | 431 | |