@@ -67,12 +67,12 @@ |
||
67 | 67 | 'institution_id' => $admissionInfo['instituion']->id, |
68 | 68 | 'academic_period_id' => $admissionInfo['academic_period']->id, |
69 | 69 | 'education_grade_id' => $admissionInfo['education_grade']->id, |
70 | - 'institution_class_id' => (($admissionInfo['instituion_class'] != []) && (count($admissionInfo['instituion_class'])==1)) ? $admissionInfo['instituion_class']['id'] : null, |
|
70 | + 'institution_class_id' => (($admissionInfo['instituion_class'] != []) && (count($admissionInfo['instituion_class']) == 1)) ? $admissionInfo['instituion_class']['id'] : null, |
|
71 | 71 | 'comment' => 'Imported From Examination Data', |
72 | 72 | 'created_user_id' => 1 |
73 | 73 | ]; |
74 | 74 | self::create($data); |
75 | - } catch (\Throwable $th) { |
|
75 | + }catch (\Throwable $th) { |
|
76 | 76 | Log::error($th); |
77 | 77 | } |
78 | 78 | } |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | $studentData['id'] = $id; |
181 | 181 | $this->uniqueUserId->updateOrInsertRecord($studentData); |
182 | 182 | return $studentData; |
183 | - } catch (\Exception $th) { |
|
183 | + }catch (\Exception $th) { |
|
184 | 184 | Log::error($th->getMessage()); |
185 | 185 | // in case of duplication of the Unique ID this will recursive. |
186 | 186 | $this->insertExaminationStudent($student); |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | $this->uniqueUserId = new Unique_user_id(); |
201 | 201 | $this->uniqueUid = new UniqueUid(); |
202 | 202 | // regenerate unique id if it's not available |
203 | - $uniqueId = $this->uniqueUId::isValidUniqueId($sis_student['openemis_no']) ? $sis_student['openemis_no'] : $this->uniqueUId::getUniqueAlphanumeric(); |
|
203 | + $uniqueId = $this->uniqueUId::isValidUniqueId($sis_student['openemis_no']) ? $sis_student['openemis_no'] : $this->uniqueUId::getUniqueAlphanumeric(); |
|
204 | 204 | |
205 | 205 | $studentData = [ |
206 | 206 | 'id' => $sis_student['id'], |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | $this->update($studentData); |
218 | 218 | $this->uniqueUserId->updateOrInsertRecord($studentData); |
219 | 219 | return $studentData; |
220 | - } catch (\Exception $th) { |
|
220 | + }catch (\Exception $th) { |
|
221 | 221 | Log::error($th->getMessage()); |
222 | 222 | // in case of duplication of the Unique ID this will recursive. |
223 | 223 | $this->updateExaminationStudent($student, $sis_student); |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | public static function boot() |
54 | 54 | { |
55 | 55 | parent::boot(); |
56 | - self::creating(function ($model) { |
|
56 | + self::creating(function($model) { |
|
57 | 57 | $model->id = (string) Uuid::generate(4); |
58 | 58 | $model->created = now(); |
59 | 59 | }); |
@@ -66,15 +66,15 @@ discard block |
||
66 | 66 | |
67 | 67 | public static function getStudentsCount($institution_class_id) |
68 | 68 | { |
69 | - $total_male_students = self::with(['student' => function ($query) { |
|
69 | + $total_male_students = self::with(['student' => function($query) { |
|
70 | 70 | $query->where('student.gender_id', '=', 1); |
71 | - }])->whereHas('student', function ($query) { |
|
71 | + }])->whereHas('student', function($query) { |
|
72 | 72 | $query->where('gender_id', '=', 1); |
73 | 73 | })->where('institution_class_id', '=', $institution_class_id)->count(); |
74 | 74 | |
75 | - $total_female_students = self::with(['student' => function ($query) { |
|
75 | + $total_female_students = self::with(['student' => function($query) { |
|
76 | 76 | $query->where('student.gender_id', '=', 2); |
77 | - }])->whereHas('student', function ($query) { |
|
77 | + }])->whereHas('student', function($query) { |
|
78 | 78 | $query->where('gender_id', '=', 2); |
79 | 79 | })->where('institution_class_id', '=', $institution_class_id)->count(); |
80 | 80 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | 'institution_id' => $admissionInfo['instituion']->id, |
127 | 127 | 'student_status_id' => 1 |
128 | 128 | ]); |
129 | - } catch (\Throwable $th) { |
|
129 | + }catch (\Throwable $th) { |
|
130 | 130 | Log::error($th); |
131 | 131 | } |
132 | 132 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | public function updateOrInsertRecord($user) |
55 | 55 | { |
56 | - try { |
|
56 | + try { |
|
57 | 57 | // regenerate unique id if it's not available |
58 | 58 | $uniqueId = $this->uniqueUserId::isValidUniqueId($user['openemis_no']) ? $this->uniqueUserId::getUniqueAlphanumeric() : $user['openemis_no']; |
59 | 59 | |
@@ -69,8 +69,8 @@ discard block |
||
69 | 69 | 'unique_id' => $uniqueId |
70 | 70 | ]); |
71 | 71 | } |
72 | - } catch (\Exception $th) { |
|
73 | - Log::error($th->getMessage()); |
|
74 | - } |
|
72 | + } catch (\Exception $th) { |
|
73 | + Log::error($th->getMessage()); |
|
74 | + } |
|
75 | 75 | } |
76 | 76 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | { |
56 | 56 | try { |
57 | 57 | // regenerate unique id if it's not available |
58 | - $uniqueId = $this->uniqueUserId::isValidUniqueId($user['openemis_no']) ? $this->uniqueUserId::getUniqueAlphanumeric() : $user['openemis_no']; |
|
58 | + $uniqueId = $this->uniqueUserId::isValidUniqueId($user['openemis_no']) ? $this->uniqueUserId::getUniqueAlphanumeric() : $user['openemis_no']; |
|
59 | 59 | |
60 | 60 | //check if the user's entry exits ? |
61 | 61 | $exists = Unique_user_id::where([ |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | 'unique_id' => $uniqueId |
70 | 70 | ]); |
71 | 71 | } |
72 | - } catch (\Exception $th) { |
|
72 | + }catch (\Exception $th) { |
|
73 | 73 | Log::error($th->getMessage()); |
74 | 74 | } |
75 | 75 | } |
@@ -52,9 +52,9 @@ |
||
52 | 52 | $value = self::where('st_no', $data['st_no'])->get(); |
53 | 53 | if (count($value) > 0) { |
54 | 54 | self::where('st_no', $data['st_no'])->update($data); |
55 | - } else { |
|
55 | + }else { |
|
56 | 56 | self::insert($data); |
57 | 57 | } |
58 | - $output->writeln('Student name: ' . ($data['f_name']) . ' has been inserted to the database'); |
|
58 | + $output->writeln('Student name: '.($data['f_name']).' has been inserted to the database'); |
|
59 | 59 | } |
60 | 60 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | public static function boot() |
64 | 64 | { |
65 | 65 | parent::boot(); |
66 | - self::creating(function ($model) { |
|
66 | + self::creating(function($model) { |
|
67 | 67 | $model->id = (string) Uuid::generate(4); |
68 | 68 | $model->created = now(); |
69 | 69 | }); |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | 'created' => now(), |
155 | 155 | 'created_user_id' => 1 |
156 | 156 | ]); |
157 | - } catch (\Throwable $th) { |
|
157 | + }catch (\Throwable $th) { |
|
158 | 158 | Log::error($th); |
159 | 159 | } |
160 | 160 | } |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | 'modified_user_id' => 1 |
189 | 189 | ] |
190 | 190 | ); |
191 | - } catch (\Throwable $th) { |
|
191 | + }catch (\Throwable $th) { |
|
192 | 192 | Log::error($th); |
193 | 193 | } |
194 | 194 | } |
@@ -15,13 +15,13 @@ |
||
15 | 15 | */ |
16 | 16 | public function handle($request, Closure $next) |
17 | 17 | { |
18 | - if($request->user()->super_admin == 1){ |
|
18 | + if ($request->user()->super_admin == 1) { |
|
19 | 19 | return $next($request); |
20 | - }elseif ($request->user() && (!($request->user()->permissions->isEmpty())) && $request->user()->permissions[0]->roles && $request->user()->permissions[0]->roles->code === 'HOMEROOM_TEACHER') { |
|
20 | + }elseif ($request->user() && (!($request->user()->permissions->isEmpty())) && $request->user()->permissions[0]->roles && $request->user()->permissions[0]->roles->code === 'HOMEROOM_TEACHER') { |
|
21 | 21 | return $next($request); |
22 | - }elseif($request->user() && (!($request->user()->principal->isEmpty())) && $request->user()->principal[0]->roles && $request->user()->principal[0]->roles->code === 'PRINCIPAL'){ |
|
22 | + }elseif ($request->user() && (!($request->user()->principal->isEmpty())) && $request->user()->principal[0]->roles && $request->user()->principal[0]->roles->code === 'PRINCIPAL') { |
|
23 | 23 | return $next($request); |
24 | - }elseif($request->user() && (!($request->user()->zonal_cordinator->isEmpty())) && $request->user()->zonal_cordinator[0]->roles && $request->user()->zonal_cordinator[0]->roles->code === 'PRINCIPAL'){ |
|
24 | + }elseif ($request->user() && (!($request->user()->zonal_cordinator->isEmpty())) && $request->user()->zonal_cordinator[0]->roles && $request->user()->zonal_cordinator[0]->roles->code === 'PRINCIPAL') { |
|
25 | 25 | return $next($request); |
26 | 26 | } |
27 | 27 | return redirect('/login')->with('status', 'Your dont have access for upload data. Please get assign your to the class and try'); |
@@ -17,11 +17,11 @@ |
||
17 | 17 | { |
18 | 18 | if($request->user()->super_admin == 1){ |
19 | 19 | return $next($request); |
20 | - }elseif ($request->user() && (!($request->user()->permissions->isEmpty())) && $request->user()->permissions[0]->roles && $request->user()->permissions[0]->roles->code === 'HOMEROOM_TEACHER') { |
|
20 | + } elseif ($request->user() && (!($request->user()->permissions->isEmpty())) && $request->user()->permissions[0]->roles && $request->user()->permissions[0]->roles->code === 'HOMEROOM_TEACHER') { |
|
21 | 21 | return $next($request); |
22 | - }elseif($request->user() && (!($request->user()->principal->isEmpty())) && $request->user()->principal[0]->roles && $request->user()->principal[0]->roles->code === 'PRINCIPAL'){ |
|
22 | + } elseif($request->user() && (!($request->user()->principal->isEmpty())) && $request->user()->principal[0]->roles && $request->user()->principal[0]->roles->code === 'PRINCIPAL'){ |
|
23 | 23 | return $next($request); |
24 | - }elseif($request->user() && (!($request->user()->zonal_cordinator->isEmpty())) && $request->user()->zonal_cordinator[0]->roles && $request->user()->zonal_cordinator[0]->roles->code === 'PRINCIPAL'){ |
|
24 | + } elseif($request->user() && (!($request->user()->zonal_cordinator->isEmpty())) && $request->user()->zonal_cordinator[0]->roles && $request->user()->zonal_cordinator[0]->roles->code === 'PRINCIPAL'){ |
|
25 | 25 | return $next($request); |
26 | 26 | } |
27 | 27 | return redirect('/login')->with('status', 'Your dont have access for upload data. Please get assign your to the class and try'); |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | $this->grade = $grade; |
27 | 27 | $this->student = new Security_user(); |
28 | 28 | $this->examination_student = new Examination_student(); |
29 | - $this->academic_period = Academic_period::where('code', '=', $this->year)->first(); |
|
29 | + $this->academic_period = Academic_period::where('code', '=', $this->year)->first(); |
|
30 | 30 | $this->education_grade = Education_grade::where('code', '=', $this->grade)->first(); |
31 | 31 | $this->output = new \Symfony\Component\Console\Output\ConsoleOutput(); |
32 | 32 | } |
@@ -68,10 +68,10 @@ discard block |
||
68 | 68 | ); |
69 | 69 | Session::flash('message', 'File upload successfully!'); |
70 | 70 | // Redirect to index |
71 | - } else { |
|
71 | + }else { |
|
72 | 72 | Session::flash('message', 'File too large. File must be less than 20MB.'); |
73 | 73 | } |
74 | - } else { |
|
74 | + }else { |
|
75 | 75 | Session::flash('message', 'Invalid File Extension.'); |
76 | 76 | } |
77 | 77 | } |
@@ -110,11 +110,11 @@ discard block |
||
110 | 110 | * @param array $students |
111 | 111 | * @return array |
112 | 112 | */ |
113 | - public function setIsTakingExam($students){ |
|
113 | + public function setIsTakingExam($students) { |
|
114 | 114 | $students['taking_g5_exam'] = false; |
115 | 115 | $students['taking_ol_exam'] = false; |
116 | 116 | $students['taking_al_exam'] = false; |
117 | - switch($this->education_grade->code){ |
|
117 | + switch ($this->education_grade->code) { |
|
118 | 118 | case 'G5': |
119 | 119 | $students['taking_g5_exam'] = true; |
120 | 120 | break; |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | case 'G11': |
128 | 128 | $students['taking_ol_exam'] = true; |
129 | 129 | break; |
130 | - case preg_match('13',$this->education_grade->code): |
|
130 | + case preg_match('13', $this->education_grade->code): |
|
131 | 131 | $students['taking_al_exam'] = true; |
132 | 132 | break; |
133 | 133 | } |
@@ -182,12 +182,12 @@ discard block |
||
182 | 182 | Institution_student::createExaminationData($student, $admissionInfo); |
183 | 183 | Institution_student_admission::createExaminationData($student, $admissionInfo); |
184 | 184 | Institution_class_student::createExaminationData($student, $admissionInfo); |
185 | - } else { |
|
185 | + }else { |
|
186 | 186 | Institution_student_admission::createExaminationData($student, $admissionInfo); |
187 | 187 | Institution_student::createExaminationData($student, $admissionInfo); |
188 | 188 | } |
189 | 189 | // update the matched student's data |
190 | - } else { |
|
190 | + }else { |
|
191 | 191 | $student = $this->student->updateExaminationStudent($student, $matchedStudent); |
192 | 192 | $matchedStudent = array_merge((array) $student, $matchedStudent); |
193 | 193 | Institution_student::updateExaminationData($matchedStudent, $admissionInfo); |
@@ -238,21 +238,21 @@ discard block |
||
238 | 238 | } |
239 | 239 | |
240 | 240 | if (($previousValue)) { |
241 | - $highest = ($percentage > $previousValue['rate']) ? $value : $value; |
|
242 | - } else { |
|
241 | + $highest = ($percentage > $previousValue['rate']) ? $value : $value; |
|
242 | + }else { |
|
243 | 243 | $highest = $value; |
244 | 244 | } |
245 | 245 | $previousValue = $value; |
246 | 246 | } |
247 | 247 | |
248 | 248 | //If the not matched 100% try to get most highest value with full name |
249 | - if ( ($highest['rate'] < 100) || (count($matchedData) > 1)) { |
|
249 | + if (($highest['rate'] < 100) || (count($matchedData) > 1)) { |
|
250 | 250 | foreach ($sis_students as $key => $value) { |
251 | 251 | similar_text($student['f_name'], $value['first_name'], $percentage); |
252 | 252 | $value['rate'] = $percentage; |
253 | 253 | if (($previousValue)) { |
254 | - $highest = ($percentage > $previousValue['rate']) ? $value : $value; |
|
255 | - } else { |
|
254 | + $highest = ($percentage > $previousValue['rate']) ? $value : $value; |
|
255 | + }else { |
|
256 | 256 | $highest = $value; |
257 | 257 | } |
258 | 258 | $previousValue = $value; |
@@ -270,10 +270,10 @@ discard block |
||
270 | 270 | */ |
271 | 271 | public function updateStudentId($student, $sis_student) |
272 | 272 | { |
273 | - $student['nsid'] = $sis_student['openemis_no']; |
|
273 | + $student['nsid'] = $sis_student['openemis_no']; |
|
274 | 274 | // add new NSID to the examinations data set |
275 | 275 | $this->examination_student->where(['st_no' => $student['st_no']])->update($student); |
276 | - $this->output->writeln('Updated ' . $sis_student['id'] . ' to NSID' . $sis_student['openemis_no']); |
|
276 | + $this->output->writeln('Updated '.$sis_student['id'].' to NSID'.$sis_student['openemis_no']); |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | /** |
@@ -29,9 +29,9 @@ discard block |
||
29 | 29 | |
30 | 30 | } |
31 | 31 | |
32 | - /** |
|
33 | - * @return \Illuminate\Support\Collection |
|
34 | - */ |
|
32 | + /** |
|
33 | + * @return \Illuminate\Support\Collection |
|
34 | + */ |
|
35 | 35 | public function importExportView() |
36 | 36 | { |
37 | 37 | if(Auth::user()->super_admin ){ |
@@ -45,11 +45,11 @@ discard block |
||
45 | 45 | |
46 | 46 | |
47 | 47 | /** |
48 | - * @return \Illuminate\Support\Collection |
|
49 | - */ |
|
48 | + * @return \Illuminate\Support\Collection |
|
49 | + */ |
|
50 | 50 | public function export(Request $request) |
51 | 51 | { |
52 | - $request->validate([ |
|
52 | + $request->validate([ |
|
53 | 53 | 'class' => 'required' |
54 | 54 | ]); |
55 | 55 | return Excel::download(new UsersExport($request->input('class')), 'users.xlsx'); |
@@ -58,8 +58,8 @@ discard block |
||
58 | 58 | |
59 | 59 | |
60 | 60 | /** |
61 | - * @return \Illuminate\Support\Collection |
|
62 | - */ |
|
61 | + * @return \Illuminate\Support\Collection |
|
62 | + */ |
|
63 | 63 | public function import(Request $request) |
64 | 64 | { |
65 | 65 |
@@ -34,11 +34,11 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function importExportView() |
36 | 36 | { |
37 | - if(Auth::user()->super_admin ){ |
|
37 | + if (Auth::user()->super_admin) { |
|
38 | 38 | return view('uploadcsv'); |
39 | - }else{ |
|
40 | - $classes = (!Auth::user()->permissions->isEmpty()) ? Auth::user()->permissions[0]->staff_class : Auth::user()->principal[0]->security_group_institution->institution_classes; |
|
41 | - return view('importExport')->with('classes',$classes); |
|
39 | + }else { |
|
40 | + $classes = (!Auth::user()->permissions->isEmpty()) ? Auth::user()->permissions[0]->staff_class : Auth::user()->principal[0]->security_group_institution->institution_classes; |
|
41 | + return view('importExport')->with('classes', $classes); |
|
42 | 42 | } |
43 | 43 | } |
44 | 44 | |
@@ -73,9 +73,9 @@ discard block |
||
73 | 73 | |
74 | 74 | |
75 | 75 | $import = new UsersImport(); |
76 | - try{ |
|
76 | + try { |
|
77 | 77 | $files = Storage::disk('sis-bulk-data-files')->allFiles(); |
78 | - Excel::import($import,request()->file('import_file')); |
|
78 | + Excel::import($import, request()->file('import_file')); |
|
79 | 79 | }catch (\Maatwebsite\Excel\Validators\ValidationException $e) { |
80 | 80 | $failures = $e->failures(); |
81 | 81 |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | { |
37 | 37 | if(Auth::user()->super_admin ){ |
38 | 38 | return view('uploadcsv'); |
39 | - }else{ |
|
39 | + } else{ |
|
40 | 40 | $classes = (!Auth::user()->permissions->isEmpty()) ? Auth::user()->permissions[0]->staff_class : Auth::user()->principal[0]->security_group_institution->institution_classes; |
41 | 41 | return view('importExport')->with('classes',$classes); |
42 | 42 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | try{ |
77 | 77 | $files = Storage::disk('sis-bulk-data-files')->allFiles(); |
78 | 78 | Excel::import($import,request()->file('import_file')); |
79 | - }catch (\Maatwebsite\Excel\Validators\ValidationException $e) { |
|
79 | + } catch (\Maatwebsite\Excel\Validators\ValidationException $e) { |
|
80 | 80 | $failures = $e->failures(); |
81 | 81 | |
82 | 82 | foreach ($failures as $failure) { |