@@ -112,12 +112,12 @@ discard block |
||
112 | 112 | $this->output->writeln('##########################################################################################################################'); |
113 | 113 | $this->output->writeln('updating from '. $shiftId); |
114 | 114 | |
115 | - }catch (\Exception $e){ |
|
115 | + } catch (\Exception $e){ |
|
116 | 116 | Log::error($e->getMessage(),[$e]); |
117 | 117 | } |
118 | 118 | } |
119 | 119 | // DB::commit(); |
120 | - }catch (\Exception $e){ |
|
120 | + } catch (\Exception $e){ |
|
121 | 121 | // DB::rollBack(); |
122 | 122 | Log::error($e->getMessage(),[$e]); |
123 | 123 | } |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | unset($subjects['total_female_students']); |
138 | 138 | unset($subjects['id']); |
139 | 139 | $classSubject = Institution_subject::create($subjects); |
140 | - }catch (\Exception $e){ |
|
140 | + } catch (\Exception $e){ |
|
141 | 141 | Log::error($e->getMessage(),[$e]); |
142 | 142 | } |
143 | 143 | } |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | $params['class'] = $class; |
181 | 181 | $this->insertInstitutionClassSubjects($institutionSubjects,$class); |
182 | 182 | // array_walk($classSubjects,array($this,'insertInstitutionClassSubjects'),$params); |
183 | - }catch (\Exception $e){ |
|
183 | + } catch (\Exception $e){ |
|
184 | 184 | Log::error($e->getMessage(),[$e]); |
185 | 185 | } |
186 | 186 | } |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | try{ |
191 | 191 | array_walk($subjects,array($this,'insertClassSubjects'),$class); |
192 | 192 | $this->output->writeln('updating subjects '. $class->name); |
193 | - }catch (\Exception $e){ |
|
193 | + } catch (\Exception $e){ |
|
194 | 194 | Log::error($e->getMessage(),[$e]); |
195 | 195 | } |
196 | 196 | }; |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | if(!$this->institution_class_subjects->isDuplicated($subjectobj)){ |
209 | 209 | $this->institution_class_subjects->create($subjectobj); |
210 | 210 | } |
211 | - }catch (\Exception $e){ |
|
211 | + } catch (\Exception $e){ |
|
212 | 212 | Log::error($e->getMessage(),[$e]); |
213 | 213 | } |
214 | 214 | } |
@@ -70,21 +70,21 @@ discard block |
||
70 | 70 | unset($files); |
71 | 71 | exit(); |
72 | 72 | |
73 | - }else{ |
|
73 | + } else{ |
|
74 | 74 | $output = new \Symfony\Component\Console\Output\ConsoleOutput(); |
75 | 75 | $this->output->writeln('No files found,Waiting for files'); |
76 | 76 | exit(); |
77 | 77 | |
78 | 78 | } |
79 | 79 | |
80 | - }catch (Exception $e){ |
|
80 | + } catch (Exception $e){ |
|
81 | 81 | $output = new \Symfony\Component\Console\Output\ConsoleOutput(); |
82 | 82 | $this->output->writeln($e); |
83 | 83 | sleep(300); |
84 | 84 | $this->handle(); |
85 | 85 | |
86 | 86 | } |
87 | - }else{ |
|
87 | + } else{ |
|
88 | 88 | exit(); |
89 | 89 | } |
90 | 90 | } |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | $output = new \Symfony\Component\Console\Output\ConsoleOutput(); |
206 | 206 | $this->output->writeln('Processing from:' . $node); |
207 | 207 | return true; |
208 | - }else{ |
|
208 | + } else{ |
|
209 | 209 | exit; |
210 | 210 | return false; |
211 | 211 | } |
@@ -321,11 +321,11 @@ discard block |
||
321 | 321 | ->update(['insert' => 3,'updated_at' => now()]); |
322 | 322 | $this->processFailedEmail($file,$user,'Fresh Student Data Upload:Partial Success '); |
323 | 323 | $this->stdOut('Insert Students',$this->higestRow); |
324 | - }else{ |
|
324 | + } else{ |
|
325 | 325 | $this->processSuccessEmail($file,$user,'Fresh Student Data Upload:Success '); |
326 | 326 | $this->stdOut('Insert Students',$this->higestRow); |
327 | 327 | } |
328 | - }else if(($this->getSheetName($file,'Insert Students')) && $this->higestRow > 0) { |
|
328 | + } else if(($this->getSheetName($file,'Insert Students')) && $this->higestRow > 0) { |
|
329 | 329 | DB::table('uploads') |
330 | 330 | ->where('id', $file['id']) |
331 | 331 | ->update(['is_processed' => 2]); |
@@ -347,11 +347,11 @@ discard block |
||
347 | 347 | ->update(['update' => 3,'is_processed' => 1,'updated_at' => now()]); |
348 | 348 | $this->processFailedEmail($file,$user,'Existing Student Data Update:Partial Success '); |
349 | 349 | $this->stdOut('Update Students',$this->higestRow); |
350 | - }else{ |
|
350 | + } else{ |
|
351 | 351 | $this->processSuccessEmail($file,$user, 'Existing Student Data Update:Success '); |
352 | 352 | $this->stdOut('Update Students',$this->higestRow); |
353 | 353 | } |
354 | - }else if(($this->getSheetName($file,'Update Students')) && $this->higestRow == 0) { |
|
354 | + } else if(($this->getSheetName($file,'Update Students')) && $this->higestRow == 0) { |
|
355 | 355 | DB::table('uploads') |
356 | 356 | ->where('id', $file['id']) |
357 | 357 | ->update(['is_processed' => 2,'updated_at' => now()]); |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | } |
360 | 360 | break; |
361 | 361 | } |
362 | - }catch (\Maatwebsite\Excel\Validators\ValidationException $e) { |
|
362 | + } catch (\Maatwebsite\Excel\Validators\ValidationException $e) { |
|
363 | 363 | $this->output->writeln( $e->getMessage()); |
364 | 364 | if($sheet == 1){ |
365 | 365 | self::writeErrors($e,$file,'Insert Students'); |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | ->where('id', $file['id']) |
368 | 368 | ->update(['insert' => 2,'updated_at' => now()]); |
369 | 369 | $this->processFailedEmail($file,$user,'Fresh Student Data Upload:Failed'); |
370 | - }else if($sheet == 2){ |
|
370 | + } else if($sheet == 2){ |
|
371 | 371 | self::writeErrors($e,$file,'Update Students'); |
372 | 372 | DB::table('uploads') |
373 | 373 | ->where('id', $file['id']) |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | $user = User::find($file['security_user_id']); |
400 | 400 | if( $size > 0){ |
401 | 401 | return true; |
402 | - }else{ |
|
402 | + } else{ |
|
403 | 403 | DB::table('uploads') |
404 | 404 | ->where('id', $file['id']) |
405 | 405 | ->update(['is_processed' =>2 , 'updated_at' => now()]); |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | $reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($this->getType($file['filename'])); |
421 | 421 | $objPHPExcel = $reader->load($excelFile); |
422 | 422 | return $objPHPExcel; |
423 | - }catch (Exception $e){ |
|
423 | + } catch (Exception $e){ |
|
424 | 424 | $this->output->writeln( $e->getMessage()); |
425 | 425 | $user = User::find($file['security_user_id']); |
426 | 426 | DB::table('uploads') |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | try{; |
436 | 436 | $objPHPExcel = $this->setReader($file); |
437 | 437 | return $objPHPExcel->getSheetByName($sheet) !== null; |
438 | - }catch (Exception $e){ |
|
438 | + } catch (Exception $e){ |
|
439 | 439 | $this->output->writeln( $e->getMessage()); |
440 | 440 | $user = User::find($file['security_user_id']); |
441 | 441 | DB::table('uploads') |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | } |
462 | 462 | } |
463 | 463 | return $higestRow; |
464 | - }catch(\Exception $e){ |
|
464 | + } catch(\Exception $e){ |
|
465 | 465 | $this->output->writeln( $e->getMessage()); |
466 | 466 | $user = User::find($file['security_user_id']); |
467 | 467 | DB::beginTransaction(); |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | unset($failures); |
535 | 535 | } |
536 | 536 | |
537 | - }catch (Eception $e){ |
|
537 | + } catch (Eception $e){ |
|
538 | 538 | $this->output->writeln( $e->getMessage()); |
539 | 539 | $user = User::find($file['security_user_id']); |
540 | 540 | DB::beginTransaction(); |
@@ -83,7 +83,7 @@ |
||
83 | 83 | ->where('institution_grades.education_grade_id', $educationGradeId) |
84 | 84 | ->where('institution_grades.institution_id', $institutionId) |
85 | 85 | ->get(); |
86 | - }else{ |
|
86 | + } else{ |
|
87 | 87 | return null; |
88 | 88 | } |
89 | 89 | } |
@@ -58,7 +58,7 @@ |
||
58 | 58 | 'preferred' => 1 |
59 | 59 | ]; |
60 | 60 | self::updateOrCreate($data); |
61 | - }else{ |
|
61 | + } else{ |
|
62 | 62 | $exists = $exists->toArray(); |
63 | 63 | $exists['preferred'] = 1; |
64 | 64 | $exists['value'] = $data['contact']; |
@@ -109,8 +109,9 @@ |
||
109 | 109 | }) |
110 | 110 | ->where('institution_class_id', '=', $student->institution_class_id) |
111 | 111 | ->get()->toArray(); |
112 | - if (!empty($subjectId)) |
|
113 | - $data[] = $subjectId[0]; |
|
112 | + if (!empty($subjectId)) { |
|
113 | + $data[] = $subjectId[0]; |
|
114 | + } |
|
114 | 115 | } |
115 | 116 | return $data; |
116 | 117 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | $Initials = $Initials . '' . mb_substr($names[$i], 0, 1, "UTF-8"); |
11 | 11 | } |
12 | 12 | $nameWithInitials = $Initials . ' ' . $names[$length - 1]; |
13 | - }else{ |
|
13 | + } else{ |
|
14 | 14 | $nameWithInitials = $fullname; |
15 | 15 | } |
16 | 16 | return $nameWithInitials; |
@@ -32,8 +32,9 @@ discard block |
||
32 | 32 | function getMatchingKeys($array){ |
33 | 33 | $keys = []; |
34 | 34 | foreach ($array as $key => $value){ |
35 | - if(strstr($key , 'option')) |
|
36 | - $keys[] = $key; |
|
35 | + if(strstr($key , 'option')) { |
|
36 | + $keys[] = $key; |
|
37 | + } |
|
37 | 38 | } |
38 | 39 | return $keys; |
39 | 40 | } |
@@ -82,7 +83,9 @@ discard block |
||
82 | 83 | function array_value_recursive($key, array $arr){ |
83 | 84 | $val = array(); |
84 | 85 | array_walk_recursive($arr, function($v, $k) use($key, &$val){ |
85 | - if($k == $key) array_push($val, $v); |
|
86 | + if($k == $key) { |
|
87 | + array_push($val, $v); |
|
88 | + } |
|
86 | 89 | }); |
87 | 90 | return count($val) > 1 ? $val : array_pop($val); |
88 | 91 | } |
@@ -174,7 +177,9 @@ discard block |
||
174 | 177 | |
175 | 178 | function isEmptyRow($row) { |
176 | 179 | foreach($row as $cell){ |
177 | - if (null !== $cell) return false; |
|
180 | + if (null !== $cell) { |
|
181 | + return false; |
|
182 | + } |
|
178 | 183 | } |
179 | 184 | return true; |
180 | 185 | } |