Test Setup Failed
Pull Request — master (#566)
by
unknown
12:42
created
app/Http/Controllers/ImportExport.php 3 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -34,11 +34,11 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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) {
Please login to merge, or discard this patch.
app/Models/Institution_student.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
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
         });
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
      */
133 133
     public static function createExaminationData($student, $admissionInfo)
134 134
     {
135
-        $student['sp_center'] = gettype((int)$student['sp_center']) == 'integer' ?  $student['sp_center'] : 0;
135
+        $student['sp_center'] = gettype((int) $student['sp_center']) == 'integer' ? $student['sp_center'] : 0;
136 136
         try {
137 137
             self::create([
138 138
                 'id' => (string) Uuid::generate(4),
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
                 'created' => now(),
157 157
                 'created_user_id' => 1
158 158
             ]);
159
-        } catch (\Throwable $th) {
159
+        }catch (\Throwable $th) {
160 160
             Log::error($th);
161 161
         }
162 162
     }
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
      */
171 171
     public static function updateExaminationData($student, $admissionInfo)
172 172
     {
173
-        $student['sp_center'] = gettype((int)$student['sp_center']) == 'integer' ?  $student['sp_center'] : 0;
173
+        $student['sp_center'] = gettype((int) $student['sp_center']) == 'integer' ? $student['sp_center'] : 0;
174 174
         try {
175 175
             self::where([
176 176
                 'student_id' => $student['student_id'],
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
                     'modified_user_id' => 1
192 192
                 ]
193 193
             );
194
-        } catch (\Throwable $th) {
194
+        }catch (\Throwable $th) {
195 195
             Log::error($th);
196 196
         }
197 197
     }
Please login to merge, or discard this patch.
app/Providers/ValidatorExtended.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -70,17 +70,17 @@  discard block
 block discarded – undo
70 70
             if (empty($value)) {
71 71
                 return false;
72 72
             } elseif ($gradeEntity !== null) {
73
-                $admissionAge = (($gradeEntity->admission_age) * 12) - 1;
73
+                $admissionAge = (($gradeEntity->admission_age)*12) - 1;
74 74
                 $to = $academicPeriod->start_date;
75 75
                 $diff_in_months = $to->diffInMonths($value);
76 76
                 $ageOfStudent = $diff_in_months;
77 77
                 $enrolmentMaximumAge = $admissionAge + 120;
78 78
                 return ($ageOfStudent <= $enrolmentMaximumAge) && ($ageOfStudent >= $admissionAge);
79
-            } else {
79
+            }else {
80 80
                 return false;
81 81
             }
82
-        } else {
83
-            $this->_custom_messages['admission_age'] = 'given' . $attribute . 'Not found';
82
+        }else {
83
+            $this->_custom_messages['admission_age'] = 'given'.$attribute.'Not found';
84 84
             $this->_set_custom_stuff();
85 85
             return false;
86 86
         }
@@ -91,16 +91,16 @@  discard block
 block discarded – undo
91 91
 
92 92
         if (is_numeric($value)) {
93 93
             if ($value < 10) {
94
-                $this->_custom_messages['bmi'] =  $attribute . ' is must greater than 10';
94
+                $this->_custom_messages['bmi'] = $attribute.' is must greater than 10';
95 95
                 $this->_set_custom_stuff();
96 96
                 return false;
97 97
             } elseif ($value > 250) {
98
-                $this->_custom_messages['bmi'] =  $attribute . ' is must smaller than 250';
98
+                $this->_custom_messages['bmi'] = $attribute.' is must smaller than 250';
99 99
                 $this->_set_custom_stuff();
100 100
                 return false;
101 101
             }
102
-        } else {
103
-            $this->_custom_messages['bmi'] =  $attribute . ' is must a valid numeric';
102
+        }else {
103
+            $this->_custom_messages['bmi'] = $attribute.' is must a valid numeric';
104 104
             $this->_set_custom_stuff();
105 105
             return false;
106 106
         }
@@ -109,18 +109,18 @@  discard block
 block discarded – undo
109 109
 
110 110
     protected function validateBmi($attribute, $value, $parameters)
111 111
     {
112
-        $bmiGrades =  ['G1', 'G4', 'G7', 'G10'];
112
+        $bmiGrades = ['G1', 'G4', 'G7', 'G10'];
113 113
         $institutionGrade = Institution_class_grade::where('institution_class_id', '=', $parameters[0])
114 114
             ->join('education_grades', 'institution_class_grades.education_grade_id', 'education_grades.id')
115 115
             ->first();
116
-        $educationGrade =  Education_grade::where('id', '=', $institutionGrade->education_grade_id)->first();
116
+        $educationGrade = Education_grade::where('id', '=', $institutionGrade->education_grade_id)->first();
117 117
         if (in_array($institutionGrade->code, $bmiGrades)) {
118 118
             if (!empty($value)) {
119 119
                 if (($attribute == 'bmi_height') || ('bmi_weight')) {
120 120
                     return $this->validateHW($attribute, $value);
121 121
                 }
122
-            } else {
123
-                $this->_custom_messages['bmi'] =  $attribute . ' is required for ' . $educationGrade->name;
122
+            }else {
123
+                $this->_custom_messages['bmi'] = $attribute.' is required for '.$educationGrade->name;
124 124
                 $this->_set_custom_stuff();
125 125
                 return false;
126 126
             }
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
             if (($attribute == 'bmi_height') || ('bmi_weight')) {
129 129
                 return $this->validateHW($attribute, $value);
130 130
             }
131
-        } else {
131
+        }else {
132 132
             return true;
133 133
         }
134 134
     }
@@ -137,19 +137,19 @@  discard block
 block discarded – undo
137 137
     {
138 138
         foreach ($validator->getData() as $data) {
139 139
             if ($data['identity_type'] == 'BC' && key_exists('birth_divisional_secretariat', $data)) {
140
-                $BirthDivision = Area_administrative::where('name', '=',  '%' . $data['birth_divisional_secretariat'] . '%')->where('area_administrative_level_id', '=', 5); //
140
+                $BirthDivision = Area_administrative::where('name', '=', '%'.$data['birth_divisional_secretariat'].'%')->where('area_administrative_level_id', '=', 5); //
141 141
                 if ($BirthDivision->count() > 0) {
142
-                    $BirthArea = Area_administrative::where('name', '=', '%' . $value . '%') //$data['birth_registrar_office_as_in_birth_certificate']
142
+                    $BirthArea = Area_administrative::where('name', '=', '%'.$value.'%') //$data['birth_registrar_office_as_in_birth_certificate']
143 143
                         ->where('parent_id', '=', $BirthDivision->first()->id)->count();
144
-                    return $BirthArea  > 0;
144
+                    return $BirthArea > 0;
145 145
                 } elseif (key_exists('birth_divisional_secretariat', $data) && (!key_exists('birth_registrar_office_as_in_birth_certificate', $data))) {
146 146
                     $this->_custom_messages['birth_place'] = 'birth_registrar_office_as_in_birth_certificate required with BC';
147 147
                     $this->_set_custom_stuff();
148 148
                     return false;
149
-                } else {
149
+                }else {
150 150
                     return true;
151 151
                 }
152
-            } else {
152
+            }else {
153 153
                 return true;
154 154
             }
155 155
         }
@@ -157,16 +157,16 @@  discard block
 block discarded – undo
157 157
 
158 158
     protected function validateIsStudentInClass($attribute, $value, $perameters, $validator)
159 159
     {
160
-        $student =  Security_user::where('openemis_no', '=', $value);
160
+        $student = Security_user::where('openemis_no', '=', $value);
161 161
         if ($student->count() > 0) {
162 162
             $student = $student->first()->toArray();
163
-            $check =  Institution_class_student::where('student_id', '=', $student['id'])->where('institution_class_id', '=', $perameters[0])->count();
163
+            $check = Institution_class_student::where('student_id', '=', $student['id'])->where('institution_class_id', '=', $perameters[0])->count();
164 164
             if ($check == 1) {
165 165
                 return true;
166
-            } else {
166
+            }else {
167 167
                 return false;
168 168
             }
169
-        } else {
169
+        }else {
170 170
             return false;
171 171
         }
172 172
     }
@@ -174,10 +174,10 @@  discard block
 block discarded – undo
174 174
     {
175 175
         $valid = preg_match('/^([0-9]{9}[VX]|[0-9]{12})$/i', $value);
176 176
         if (!$valid) {
177
-            $this->_custom_messages['nic'] = $attribute . ' is not valid,  Please check the NIC number';
177
+            $this->_custom_messages['nic'] = $attribute.' is not valid,  Please check the NIC number';
178 178
             $this->_set_custom_stuff();
179 179
             return false;
180
-        } else {
180
+        }else {
181 181
             return true;
182 182
         }
183 183
     }
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
     protected function validateUserUnique($attribute, $value, $perameters, $validator)
186 186
     {
187 187
         foreach ($validator->getData() as $data) {
188
-            $identityType = Identity_type::where('national_code', 'like', '%' . $data['identity_type'] . '%')->first();
188
+            $identityType = Identity_type::where('national_code', 'like', '%'.$data['identity_type'].'%')->first();
189 189
             if ($identityType !== null && ($value !== null)) {
190 190
                 if ($identityType->national_code === 'BC') {
191 191
                     return $this->checkUnique($value, $data, $identityType);
@@ -201,14 +201,14 @@  discard block
 block discarded – undo
201 201
     protected function validateIsBc($attribute, $value, $perameters, $validator)
202 202
     {
203 203
         foreach ($validator->getData() as $data) {
204
-            $identityType = Identity_type::where('national_code', 'like', '%' . $data['identity_type'] . '%')->first();
204
+            $identityType = Identity_type::where('national_code', 'like', '%'.$data['identity_type'].'%')->first();
205 205
             if (($identityType !== null) && ($identityType !== "")) {
206 206
                 if (($identityType->national_code) === 'BC') {
207 207
                     return (strlen((string) $data['identity_number']) < 7);
208
-                } else {
208
+                }else {
209 209
                     return true;
210 210
                 }
211
-            } else {
211
+            }else {
212 212
                 return true;
213 213
             }
214 214
         }
@@ -218,24 +218,24 @@  discard block
 block discarded – undo
218 218
     {
219 219
         $isUnique = Security_user::where('identity_number', '=', $value)->where('identity_type_id', '=', $identityType->id);
220 220
         if ($isUnique->count() > 0) {
221
-            $this->_custom_messages['user_unique'] = 'The identity number already in use. User ID is : ' . $isUnique->first()->openemis_no;
221
+            $this->_custom_messages['user_unique'] = 'The identity number already in use. User ID is : '.$isUnique->first()->openemis_no;
222 222
             $this->_set_custom_stuff();
223 223
             return false;
224
-        } else {
224
+        }else {
225 225
             return true;
226 226
         }
227 227
     }
228 228
 
229 229
     protected function IsBc($data, $value)
230 230
     {
231
-        $identityType = Identity_type::where('national_code', 'like', '%' . $data['identity_type'] . '%')->first();
231
+        $identityType = Identity_type::where('national_code', 'like', '%'.$data['identity_type'].'%')->first();
232 232
         if ($identityType !== null) {
233 233
             if (($identityType->national_code) === 'BC' && strlen((string) $value) < 8) {
234 234
                 return false;
235
-            } else {
235
+            }else {
236 236
                 return true;
237 237
             }
238
-        } else {
238
+        }else {
239 239
             return true;
240 240
         }
241 241
     }
Please login to merge, or discard this patch.
app/Http/Controllers/FileController.php 2 patches
Braces   +4 added lines, -7 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
             DB::table('uploads')
100 100
                 ->where('id', $id)
101 101
                 ->update(['is_processed' => 0]);
102
-        }elseif ($action == 200) {
102
+        } elseif ($action == 200) {
103 103
             DB::table('uploads')
104 104
                 ->where('id', $id)
105 105
                 ->update(['is_processed' => 4]);
@@ -116,8 +116,7 @@  discard block
 block discarded – undo
116 116
             return Response::download($file_path, Auth::user()->openemis_no.'_'.$filename.$version, [
117 117
                 'Content-Length: '. filesize($file_path)
118 118
             ]);
119
-        }
120
-        else
119
+        } else
121 120
         {
122 121
             return response()->view('errors.404');
123 122
         }
@@ -136,8 +135,7 @@  discard block
 block discarded – undo
136 135
             return Response::download($file_path, $filename, [
137 136
                 'Content-Length: '. filesize($file_path)
138 137
             ]);
139
-        }
140
-        else
138
+        } else
141 139
         {
142 140
             abort(404, 'We did not found an error file.');
143 141
         }
@@ -151,8 +149,7 @@  discard block
 block discarded – undo
151 149
             return Response::download($file_path, $filename, [
152 150
                 'Content-Length: '. filesize($file_path)
153 151
             ]);
154
-        }
155
-        else
152
+        } else
156 153
         {
157 154
 
158 155
             abort(404, 'We did not found an error file.');
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
      * @param Request $request
34 34
      * @return \Illuminate\Http\JsonResponse
35 35
      */
36
-    public function upload(Request $request){
36
+    public function upload(Request $request) {
37 37
 
38 38
 
39 39
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
         $institution = auth()->user()->permissions->isEmpty() ? auth()->user()->principal[0]->institution_group[0]->institution->code : auth()->user()->permissions[0]->institution_staff->institution->code;
76 76
 
77 77
 
78
-        $fileName = time().'_'.$institution.'_'.str_replace(' ','_', clean($class->name)).'_'.auth()->user()->openemis_no.'_student_bulk_data.xlsx';
78
+        $fileName = time().'_'.$institution.'_'.str_replace(' ', '_', clean($class->name)).'_'.auth()->user()->openemis_no.'_student_bulk_data.xlsx';
79 79
         Storage::disk('local')->putFileAs(
80 80
             'sis-bulk-data-files/',
81 81
             $uploadFile,
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
         );
84 84
 
85 85
         $upload = new Upload;
86
-        $upload->fileName =$fileName;
86
+        $upload->fileName = $fileName;
87 87
         $upload->model = 'Student';
88 88
         $upload->node = 'None';
89 89
         $upload->institution_class_id = $class->id;
@@ -94,8 +94,8 @@  discard block
 block discarded – undo
94 94
         return redirect('/')->withSuccess('The file is uploaded, we will process and let you know by your email');
95 95
     }
96 96
 
97
-    public function updateQueueWithUnprocessedFiles($id, $action){
98
-        if($action == 100){
97
+    public function updateQueueWithUnprocessedFiles($id, $action) {
98
+        if ($action == 100) {
99 99
             DB::table('uploads')
100 100
                 ->where('id', $id)
101 101
                 ->update(['is_processed' => 0]);
@@ -107,14 +107,14 @@  discard block
 block discarded – undo
107 107
     }
108 108
 
109 109
 
110
-    public function downloadTemplate(){
110
+    public function downloadTemplate() {
111 111
         $filename = 'censusNo_className_sis_students_bulk_upload';
112 112
         $version = '2007_V2.1.0_20200928.xlsx';
113
-        $file_path = storage_path() .'/app/public/'. $filename.'_'.$version;;
113
+        $file_path = storage_path().'/app/public/'.$filename.'_'.$version; ;
114 114
         if (file_exists($file_path))
115 115
         {
116 116
             return Response::download($file_path, Auth::user()->openemis_no.'_'.$filename.$version, [
117
-                'Content-Length: '. filesize($file_path)
117
+                'Content-Length: '.filesize($file_path)
118 118
             ]);
119 119
         }
120 120
         else
@@ -128,13 +128,13 @@  discard block
 block discarded – undo
128 128
      * @param $filename
129 129
      * @return Processed excel file with error
130 130
      */
131
-    public function downloadErrorFile($filename){
131
+    public function downloadErrorFile($filename) {
132 132
 
133
-        $file_path = storage_path().'/app/sis-bulk-data-files/processed/'. $filename;
133
+        $file_path = storage_path().'/app/sis-bulk-data-files/processed/'.$filename;
134 134
         if (file_exists($file_path))
135 135
         {
136 136
             return Response::download($file_path, $filename, [
137
-                'Content-Length: '. filesize($file_path)
137
+                'Content-Length: '.filesize($file_path)
138 138
             ]);
139 139
         }
140 140
         else
@@ -144,12 +144,12 @@  discard block
 block discarded – undo
144 144
     }
145 145
 
146 146
 
147
-    public function downloadFile($filename){
148
-        $file_path = storage_path().'/app/sis-bulk-data-files/'. $filename;
147
+    public function downloadFile($filename) {
148
+        $file_path = storage_path().'/app/sis-bulk-data-files/'.$filename;
149 149
         if (file_exists($file_path))
150 150
         {
151 151
             return Response::download($file_path, $filename, [
152
-                'Content-Length: '. filesize($file_path)
152
+                'Content-Length: '.filesize($file_path)
153 153
             ]);
154 154
         }
155 155
         else
Please login to merge, or discard this patch.
app/Http/Controllers/CloneController.php 3 patches
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 
17 17
 class CloneController extends Controller
18 18
 {
19
-  /**
19
+    /**
20 20
      * Create a new command instance.
21 21
      *
22 22
      * @return void
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
         $this->output->writeln('cleaned subjects');
55 55
 
56 56
         do{
57
-          $deleted =  $this->institution_subjects->where('academic_period_id',$academicPeriod->id)->limit(100000)->delete();
58
-          $this->output->writeln('100000 institutions cleaned shifts');
57
+            $deleted =  $this->institution_subjects->where('academic_period_id',$academicPeriod->id)->limit(100000)->delete();
58
+            $this->output->writeln('100000 institutions cleaned shifts');
59 59
         }while($deleted > 0);
60 60
     }
61 61
 
@@ -86,13 +86,13 @@  discard block
 block discarded – undo
86 86
 
87 87
                 }catch (\Exception $e){
88 88
                     dd($e);
89
-                     Log::error($e->getMessage(),[$e]);
89
+                        Log::error($e->getMessage(),[$e]);
90 90
                 }
91 91
             }
92 92
 //            DB::commit();
93 93
         }catch (\Exception $e){
94 94
 //            DB::rollBack();
95
-             Log::error($e->getMessage(),[$e]);
95
+                Log::error($e->getMessage(),[$e]);
96 96
         }
97 97
     }
98 98
 
@@ -103,16 +103,16 @@  discard block
 block discarded – undo
103 103
      * @param $academicPeriod
104 104
      */
105 105
     public function insertInstitutionSubjects($subjects, $count,$academicPeriod){
106
-       try{
107
-           $subjects['academic_period_id'] = $academicPeriod->id;
108
-           $subjects['created'] = now();
109
-           unset($subjects['total_male_students']);
110
-           unset($subjects['total_female_students']);
111
-           unset($subjects['id']);
112
-           $this->institution_subjects->create($subjects);
113
-       }catch (\Exception $e){
106
+        try{
107
+            $subjects['academic_period_id'] = $academicPeriod->id;
108
+            $subjects['created'] = now();
109
+            unset($subjects['total_male_students']);
110
+            unset($subjects['total_female_students']);
111
+            unset($subjects['id']);
112
+            $this->institution_subjects->create($subjects);
113
+        }catch (\Exception $e){
114 114
             Log::error($e->getMessage(),[$e]);
115
-       }
115
+        }
116 116
     }
117 117
 
118 118
 
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
                 $this->insertInstitutionClassSubjects($institutionSubjects,$class);
155 155
 //                array_walk($classSubjects,array($this,'insertInstitutionClassSubjects'),$params);
156 156
             }catch (\Exception $e){
157
-                 Log::error($e->getMessage(),[$e]);
157
+                    Log::error($e->getMessage(),[$e]);
158 158
             }
159 159
     }
160 160
 
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
                 array_walk($subjects,array($this,'insertClassSubjects'),$class);
165 165
                 $this->output->writeln('updating subjects '. $class->name);
166 166
             }catch (\Exception $e){
167
-                 Log::error($e->getMessage(),[$e]);
167
+                    Log::error($e->getMessage(),[$e]);
168 168
             }
169 169
         };
170 170
     }
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
                 $this->institution_class_subjects->create($subjectobj);
184 184
             }
185 185
         }catch (\Exception $e){
186
-             Log::error($e->getMessage(),[$e]);
186
+                Log::error($e->getMessage(),[$e]);
187 187
         }
188 188
     }
189 189
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -84,13 +84,13 @@  discard block
 block discarded – undo
84 84
                     $this->output->writeln('##########################################################################################################################');
85 85
                     $this->output->writeln('updating from '. $shiftId);
86 86
 
87
-                }catch (\Exception $e){
87
+                } catch (\Exception $e){
88 88
                     dd($e);
89 89
                      Log::error($e->getMessage(),[$e]);
90 90
                 }
91 91
             }
92 92
 //            DB::commit();
93
-        }catch (\Exception $e){
93
+        } catch (\Exception $e){
94 94
 //            DB::rollBack();
95 95
              Log::error($e->getMessage(),[$e]);
96 96
         }
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
            unset($subjects['total_female_students']);
111 111
            unset($subjects['id']);
112 112
            $this->institution_subjects->create($subjects);
113
-       }catch (\Exception $e){
113
+       } catch (\Exception $e){
114 114
             Log::error($e->getMessage(),[$e]);
115 115
        }
116 116
     }
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
                 $params['class'] = $class;
154 154
                 $this->insertInstitutionClassSubjects($institutionSubjects,$class);
155 155
 //                array_walk($classSubjects,array($this,'insertInstitutionClassSubjects'),$params);
156
-            }catch (\Exception $e){
156
+            } catch (\Exception $e){
157 157
                  Log::error($e->getMessage(),[$e]);
158 158
             }
159 159
     }
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
             try{
164 164
                 array_walk($subjects,array($this,'insertClassSubjects'),$class);
165 165
                 $this->output->writeln('updating subjects '. $class->name);
166
-            }catch (\Exception $e){
166
+            } catch (\Exception $e){
167 167
                  Log::error($e->getMessage(),[$e]);
168 168
             }
169 169
         };
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
             if(!$this->institution_class_subjects->isDuplicated($subjectobj)){
183 183
                 $this->institution_class_subjects->create($subjectobj);
184 184
             }
185
-        }catch (\Exception $e){
185
+        } catch (\Exception $e){
186 186
              Log::error($e->getMessage(),[$e]);
187 187
         }
188 188
     }
Please login to merge, or discard this patch.
Spacing   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -28,17 +28,17 @@  discard block
 block discarded – undo
28 28
         $this->academic_period = new Academic_period();
29 29
         $this->institution_classes = new Institution_class();
30 30
         $this->institution_class_subjects = new Institution_class_subject();
31
-        $this->institution_subjects =  new Institution_subject();
32
-        $this->education_grade_subjects =  new Education_grades_subject();
31
+        $this->institution_subjects = new Institution_subject();
32
+        $this->education_grade_subjects = new Education_grades_subject();
33 33
         $this->output = new \Symfony\Component\Console\Output\ConsoleOutput();
34 34
     }
35 35
 
36 36
 
37
-    public function array_walk($shift,$count,$params){
38
-        array_walk($shift,array($this,'process'),$params);
37
+    public function array_walk($shift, $count, $params) {
38
+        array_walk($shift, array($this, 'process'), $params);
39 39
     }
40 40
 
41
-    public function cleanConfig($params){
41
+    public function cleanConfig($params) {
42 42
         $academicPeriod = $params['academic_period'];
43 43
         $this->shifts->where(['academic_period_id' => $academicPeriod->id])->delete();
44 44
         $this->output->writeln('cleaned shifts');
@@ -46,32 +46,32 @@  discard block
 block discarded – undo
46 46
         $this->shifts->where(['cloned' => $academicPeriod->code])->update(['cloned' => $academicPeriod->code - 1]);
47 47
         $this->output->writeln('updated shifts');
48 48
 
49
-        $classIds =  $this->institution_classes->select('id')->where(['academic_period_id' => $academicPeriod->id])->get()->toArray();
49
+        $classIds = $this->institution_classes->select('id')->where(['academic_period_id' => $academicPeriod->id])->get()->toArray();
50 50
         $this->institution_classes->where(['academic_period_id' => $academicPeriod->id])->delete();
51 51
         $this->output->writeln('cleaned classes');
52 52
 
53
-        $this->institution_class_subjects->whereNotIn( 'institution_class_id' , $classIds)->delete();
53
+        $this->institution_class_subjects->whereNotIn('institution_class_id', $classIds)->delete();
54 54
         $this->output->writeln('cleaned subjects');
55 55
 
56
-        do{
57
-          $deleted =  $this->institution_subjects->where('academic_period_id',$academicPeriod->id)->limit(100000)->delete();
56
+        do {
57
+          $deleted = $this->institution_subjects->where('academic_period_id', $academicPeriod->id)->limit(100000)->delete();
58 58
           $this->output->writeln('100000 institutions cleaned shifts');
59
-        }while($deleted > 0);
59
+        } while ($deleted > 0);
60 60
     }
61 61
 
62
-    public function process($shift,$count,$params){
63
-        echo('['.getmypid().']This Process executed at'.date("F d, Y h:i:s A")."\n") ;
62
+    public function process($shift, $count, $params) {
63
+        echo('['.getmypid().']This Process executed at'.date("F d, Y h:i:s A")."\n");
64 64
         $year = $params['year'];
65 65
         $academicPeriod = $params['academic_period'];
66 66
         $previousAcademicPeriod = $params['previous_academic_period'];
67
-        try{
67
+        try {
68 68
             $shiftId = $this->updateShifts($year, $shift);
69 69
             $institutionClasses = $this->institution_classes->getShiftClasses($shift['id']);
70
-            $institutionSubjects = $this->institution_subjects->getInstitutionSubjects($shift['institution_id'],$previousAcademicPeriod->id);
71
-            array_walk($institutionSubjects , array($this,'insertInstitutionSubjects'),$academicPeriod);
72
-            if (!empty($institutionClasses) && !is_null($shiftId) && !is_null($academicPeriod) ) {
70
+            $institutionSubjects = $this->institution_subjects->getInstitutionSubjects($shift['institution_id'], $previousAcademicPeriod->id);
71
+            array_walk($institutionSubjects, array($this, 'insertInstitutionSubjects'), $academicPeriod);
72
+            if (!empty($institutionClasses) && !is_null($shiftId) && !is_null($academicPeriod)) {
73 73
 
74
-                $newInstitutionClasses = $this->generateNewClass($institutionClasses,$shiftId,$academicPeriod->id);
74
+                $newInstitutionClasses = $this->generateNewClass($institutionClasses, $shiftId, $academicPeriod->id);
75 75
 
76 76
                 $params = [
77 77
                     'previous_academic_period_id' => $previousAcademicPeriod->id,
@@ -79,21 +79,21 @@  discard block
 block discarded – undo
79 79
                     'shift_id' =>$shiftId
80 80
                 ];
81 81
 
82
-                try{
83
-                    array_walk($newInstitutionClasses,array($this,'insertInstitutionClasses'),$params);
82
+                try {
83
+                    array_walk($newInstitutionClasses, array($this, 'insertInstitutionClasses'), $params);
84 84
                     $newInstitutionClasses = $this->institution_classes->getShiftClasses($shiftId);
85 85
                     $this->output->writeln('##########################################################################################################################');
86
-                    $this->output->writeln('updating from '. $shiftId);
86
+                    $this->output->writeln('updating from '.$shiftId);
87 87
 
88
-                }catch (\Exception $e){
88
+                }catch (\Exception $e) {
89 89
                     dd($e);
90
-                     Log::error($e->getMessage(),[$e]);
90
+                     Log::error($e->getMessage(), [$e]);
91 91
                 }
92 92
             }
93 93
 //            DB::commit();
94
-        }catch (\Exception $e){
94
+        }catch (\Exception $e) {
95 95
 //            DB::rollBack();
96
-             Log::error($e->getMessage(),[$e]);
96
+             Log::error($e->getMessage(), [$e]);
97 97
         }
98 98
     }
99 99
 
@@ -103,31 +103,31 @@  discard block
 block discarded – undo
103 103
      * @param $count
104 104
      * @param $academicPeriod
105 105
      */
106
-    public function insertInstitutionSubjects($subjects, $count,$academicPeriod){
107
-       try{
106
+    public function insertInstitutionSubjects($subjects, $count, $academicPeriod) {
107
+       try {
108 108
            $subjects['academic_period_id'] = $academicPeriod->id;
109 109
            $subjects['created'] = now();
110 110
            unset($subjects['total_male_students']);
111 111
            unset($subjects['total_female_students']);
112 112
            unset($subjects['id']);
113 113
            $this->institution_subjects->create($subjects);
114
-       }catch (\Exception $e){
115
-            Log::error($e->getMessage(),[$e]);
114
+       }catch (\Exception $e) {
115
+            Log::error($e->getMessage(), [$e]);
116 116
        }
117 117
     }
118 118
 
119 119
 
120
-    public function  insertInstitutionClasses($class,$count,$param){
121
-            try{
120
+    public function  insertInstitutionClasses($class, $count, $param) {
121
+            try {
122 122
 
123 123
                 $academicPeriod = $param['academic_period_id'];
124 124
                 $educationGrdae = $class['education_grade_id'];
125 125
 
126 126
                 $classId = $class['id'];
127 127
                 unset($class['id']);
128
-                $institutionSubjects = Institution_subject::query()->where('education_grade_id',$class['education_grade_id'])
129
-                    ->where('institution_id',$class['institution_id'])
130
-                    ->where('academic_period_id',$academicPeriod)->get()->toArray();
128
+                $institutionSubjects = Institution_subject::query()->where('education_grade_id', $class['education_grade_id'])
129
+                    ->where('institution_id', $class['institution_id'])
130
+                    ->where('academic_period_id', $academicPeriod)->get()->toArray();
131 131
                 $params = [
132 132
                     'class'=>$class,
133 133
                     'subjects'=>$institutionSubjects,
@@ -140,39 +140,39 @@  discard block
 block discarded – undo
140 140
                 $class['no_of_students'] = $noOfStudents;
141 141
                 $class['created'] = now();
142 142
                 $class['institution_shift_id'] = $param['shift_id'];
143
-                $this->output->writeln('Create class:'. $class['name']);
143
+                $this->output->writeln('Create class:'.$class['name']);
144 144
                 $class = Institution_class::create($class);
145 145
                 $institutionClassGrdaeObj['institution_class_id'] = $class->id;
146 146
                 $institutionClassGrdaeObj['education_grade_id'] = $educationGrdae;
147 147
                 Institution_class_grade::create($institutionClassGrdaeObj);
148
-                $institutionSubjects = Institution_subject::query()->where('education_grade_id',$educationGrdae)
149
-                    ->where('institution_id',$class->institution_id)
150
-                    ->where('academic_period_id',$academicPeriod)
148
+                $institutionSubjects = Institution_subject::query()->where('education_grade_id', $educationGrdae)
149
+                    ->where('institution_id', $class->institution_id)
150
+                    ->where('academic_period_id', $academicPeriod)
151 151
                     ->groupBy('education_subject_id')
152 152
                     ->get()
153 153
                     ->toArray();
154 154
                 $params['class'] = $class;
155
-                $this->insertInstitutionClassSubjects($institutionSubjects,$class);
155
+                $this->insertInstitutionClassSubjects($institutionSubjects, $class);
156 156
 //                array_walk($classSubjects,array($this,'insertInstitutionClassSubjects'),$params);
157
-            }catch (\Exception $e){
158
-                 Log::error($e->getMessage(),[$e]);
157
+            }catch (\Exception $e) {
158
+                 Log::error($e->getMessage(), [$e]);
159 159
             }
160 160
     }
161 161
 
162
-    public function insertInstitutionClassSubjects($subjects,$class){
163
-        if(!empty($subjects)){
164
-            try{
165
-                array_walk($subjects,array($this,'insertClassSubjects'),$class);
166
-                $this->output->writeln('updating subjects '. $class->name);
167
-            }catch (\Exception $e){
168
-                 Log::error($e->getMessage(),[$e]);
162
+    public function insertInstitutionClassSubjects($subjects, $class) {
163
+        if (!empty($subjects)) {
164
+            try {
165
+                array_walk($subjects, array($this, 'insertClassSubjects'), $class);
166
+                $this->output->writeln('updating subjects '.$class->name);
167
+            }catch (\Exception $e) {
168
+                 Log::error($e->getMessage(), [$e]);
169 169
             }
170 170
         };
171 171
     }
172 172
 
173 173
   
174
-    public function insertClassSubjects($subject,$count,$newClassId){
175
-        try{
174
+    public function insertClassSubjects($subject, $count, $newClassId) {
175
+        try {
176 176
             $subjectobj['status'] = 1;
177 177
             $subjectobj['created_user_id'] = 1;
178 178
             $subjectobj['created'] = now();
@@ -180,11 +180,11 @@  discard block
 block discarded – undo
180 180
             $subjectobj['institution_class_id'] = $newClassId->id;
181 181
             $subjectobj['institution_subject_id'] = $subject['id'];
182 182
 
183
-            if(!$this->institution_class_subjects->isDuplicated($subjectobj)){
183
+            if (!$this->institution_class_subjects->isDuplicated($subjectobj)) {
184 184
                 $this->institution_class_subjects->create($subjectobj);
185 185
             }
186
-        }catch (\Exception $e){
187
-             Log::error($e->getMessage(),[$e]);
186
+        }catch (\Exception $e) {
187
+             Log::error($e->getMessage(), [$e]);
188 188
         }
189 189
     }
190 190
 
@@ -196,15 +196,15 @@  discard block
 block discarded – undo
196 196
      * @param $academicPeriod
197 197
      * @return array
198 198
      */
199
-    public function generateNewClass($classes,$shiftId,$academicPeriod){
199
+    public function generateNewClass($classes, $shiftId, $academicPeriod) {
200 200
         $newClasses = [];
201
-        foreach ( $classes as $class) {
201
+        foreach ($classes as $class) {
202 202
             $noOfStudents = $class['no_of_students'] == 0 ? 40 : $class['no_of_students'];
203 203
             $class['academic_period_id'] = $academicPeriod;
204 204
             $class['no_of_students'] = $noOfStudents;
205 205
             $class['created'] = now();
206 206
             $class['institution_shift_id'] = $shiftId;
207
-            array_push($newClasses,$class);
207
+            array_push($newClasses, $class);
208 208
         }
209 209
         return $newClasses;
210 210
     }
@@ -215,11 +215,11 @@  discard block
 block discarded – undo
215 215
      * @param $shift
216 216
      * @return mixed
217 217
      */
218
-    public function updateShifts($year,$shift){
218
+    public function updateShifts($year, $shift) {
219 219
         $academicPeriod = $this->academic_period->getAcademicPeriod($year);
220
-        $this->shifts->where('id',$shift['id'])->update(['cloned' => $year]);
220
+        $this->shifts->where('id', $shift['id'])->update(['cloned' => $year]);
221 221
         $shift['academic_period_id'] = $academicPeriod->id;
222 222
         $exist = $this->shifts->shiftExists($shift);
223
-        return $this->shifts->create((array)$shift)->id;
223
+        return $this->shifts->create((array) $shift)->id;
224 224
     }
225 225
 }
Please login to merge, or discard this patch.
app/Http/Controllers/FilesController.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@
 block discarded – undo
80 80
                 }
81 81
 
82 82
             })
83
-             ->editColumn('error', function ($data) {
83
+                ->editColumn('error', function ($data) {
84 84
                 if(\App::environment('local') || \App::environment('stage')){
85 85
                     return '<a href="/download/'.$data->filename.'">'.$data->classRoom->name.'</a>';
86 86
 
Please login to merge, or discard this patch.
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -13,101 +13,101 @@
 block discarded – undo
13 13
 
14 14
     public function index()
15 15
     {
16
-        return Datatables::of(Upload::with(['classRoom'])->where('security_user_id','=',Auth::user()->id))
17
-            ->editColumn('is_processed', function ($data) {
16
+        return Datatables::of(Upload::with(['classRoom'])->where('security_user_id', '=', Auth::user()->id))
17
+            ->editColumn('is_processed', function($data) {
18 18
 
19 19
                 $nowTime = \Carbon\Carbon::now();
20 20
                 $to = \Carbon\Carbon::createFromFormat('Y-m-d H:s:i', $nowTime);
21 21
                 $from = \Carbon\Carbon::createFromFormat('Y-m-d H:s:i', $data->updated_at);
22 22
                 $diff_in_hours = $to->diffInHours($from);
23 23
 
24
-                if($diff_in_hours >= 2 && $data->is_processed == 3){
24
+                if ($diff_in_hours >= 2 && $data->is_processed == 3) {
25 25
                     return "Terminated";
26 26
                 }
27 27
                 elseif ($data->is_processed === 1) {
28 28
                     return "Success";
29
-                }elseif ($data->is_processed === 2){
29
+                }elseif ($data->is_processed === 2) {
30 30
                     return "Failed";
31
-                }elseif($diff_in_hours < 2 && $data->is_processed == 3){
31
+                }elseif ($diff_in_hours < 2 && $data->is_processed == 3) {
32 32
                     return "Processing";
33
-                }elseif ($data->is_processed == 4){
33
+                }elseif ($data->is_processed == 4) {
34 34
                     return "Process Paused";
35
-                }else{
35
+                }else {
36 36
                     return 'Pending';
37 37
                 };
38 38
 
39 39
             })
40
-            ->editColumn('is_email_sent', function ($data) {
40
+            ->editColumn('is_email_sent', function($data) {
41 41
                 if ($data->is_email_sent == 1) {
42 42
                     return "Success";
43
-                }elseif($data->is_email_sent == 2 ){
43
+                }elseif ($data->is_email_sent == 2) {
44 44
                     return 'Failed';
45
-                }else{
45
+                }else {
46 46
                     return 'Pending';
47 47
                 };
48 48
 
49 49
             })
50
-            ->editColumn('update', function ($data) {
51
-                if ((int)$data->update  == 0) {
50
+            ->editColumn('update', function($data) {
51
+                if ((int) $data->update == 0) {
52 52
                     return "No Processes";
53
-                }elseif((int)$data->update == 1 ){
53
+                }elseif ((int) $data->update == 1) {
54 54
                     return 'Success';
55
-                }elseif((int)$data->update == 2 ){
55
+                }elseif ((int) $data->update == 2) {
56 56
                     return 'Failed';
57
-                }elseif((int)$data->update == 3 ){
57
+                }elseif ((int) $data->update == 3) {
58 58
                     return 'Partial Success';
59 59
                 };
60 60
 
61 61
             })
62
-            ->editColumn('insert', function ($data) {
62
+            ->editColumn('insert', function($data) {
63 63
                 if ($data->insert == 0) {
64 64
                     return "No Processes";
65
-                }elseif($data->insert == 1 ){
65
+                }elseif ($data->insert == 1) {
66 66
                     return 'Success';
67
-                }elseif($data->insert == 2 ){
67
+                }elseif ($data->insert == 2) {
68 68
                     return 'Failed';
69
-                }elseif($data->insert == 3 ){
69
+                }elseif ($data->insert == 3) {
70 70
                     return 'Partial Success';
71 71
                 };
72 72
 
73 73
             })
74
-            ->editColumn('filename', function ($data) {
75
-                if(\App::environment('local') || \App::environment('stage')){
74
+            ->editColumn('filename', function($data) {
75
+                if (\App::environment('local') || \App::environment('stage')) {
76 76
                     return '<a href="/download_file/'.$data->filename.'">'.$data->classRoom->name.'</a>';
77 77
 
78
-                }else{
78
+                }else {
79 79
                     return '<a href="/bulk-upload/download_file/'.$data->filename.'">'.$data->classRoom->name.'</a>';
80 80
                 }
81 81
 
82 82
             })
83
-             ->editColumn('error', function ($data) {
84
-                if(\App::environment('local') || \App::environment('stage')){
83
+             ->editColumn('error', function($data) {
84
+                if (\App::environment('local') || \App::environment('stage')) {
85 85
                     return '<a href="/download/'.$data->filename.'">'.$data->classRoom->name.'</a>';
86 86
 
87
-                }else{
87
+                }else {
88 88
                     return '<a href="/bulk-upload/download/'.$data->filename.'">'.$data->classRoom->name.'</a>';
89 89
                 }
90 90
 
91
-            })->editColumn('actions', function ($data) {
91
+            })->editColumn('actions', function($data) {
92 92
 
93 93
                 $nowTime = \Carbon\Carbon::now();
94 94
                 $to = \Carbon\Carbon::createFromFormat('Y-m-d H:s:i', $nowTime);
95 95
                 $from = \Carbon\Carbon::createFromFormat('Y-m-d H:s:i', $data->updated_at);
96 96
                 $diff_in_hours = $to->diffInHours($from);
97 97
 
98
-                if($diff_in_hours >= 2 && $data->is_processed == 3){
98
+                if ($diff_in_hours >= 2 && $data->is_processed == 3) {
99 99
                     return '<button onclick="updateProcess('.($data->id).',100)" class="btn btn-primary text-uppercase">reprocess</button>';
100
-                }elseif ($data->is_processed == 1){
100
+                }elseif ($data->is_processed == 1) {
101 101
                     return '<div><h6>Processing <span class="badge badge-success text-uppercase">Successful</span></h6></div>';
102
-                }elseif ($data->is_processed == 2){
102
+                }elseif ($data->is_processed == 2) {
103 103
                     return '<div><h6>Processing <span class="badge badge-danger text-uppercase">Failed</span></h6></div>';
104
-                }elseif ($data->is_processed == 0){
104
+                }elseif ($data->is_processed == 0) {
105 105
                     return '<button onclick="updateProcess('.($data->id).',200)" class="btn btn-block btn-warning text-uppercase">pause</button>';
106
-                }elseif ($data->is_processed == 4){
106
+                }elseif ($data->is_processed == 4) {
107 107
                     return '<button onclick="updateProcess('.($data->id).',100)" class="btn btn-block btn-success text-uppercase">resume</button>';
108 108
                 }
109 109
             })
110
-            ->rawColumns(['filename','error','actions'])
110
+            ->rawColumns(['filename', 'error', 'actions'])
111 111
             ->make(true);
112 112
     }
113 113
 
Please login to merge, or discard this patch.
Braces   +19 added lines, -20 removed lines patch added patch discarded remove patch
@@ -23,16 +23,15 @@  discard block
 block discarded – undo
23 23
 
24 24
                 if($diff_in_hours >= 2 && $data->is_processed == 3){
25 25
                     return "Terminated";
26
-                }
27
-                elseif ($data->is_processed === 1) {
26
+                } elseif ($data->is_processed === 1) {
28 27
                     return "Success";
29
-                }elseif ($data->is_processed === 2){
28
+                } elseif ($data->is_processed === 2){
30 29
                     return "Failed";
31
-                }elseif($diff_in_hours < 2 && $data->is_processed == 3){
30
+                } elseif($diff_in_hours < 2 && $data->is_processed == 3){
32 31
                     return "Processing";
33
-                }elseif ($data->is_processed == 4){
32
+                } elseif ($data->is_processed == 4){
34 33
                     return "Process Paused";
35
-                }else{
34
+                } else{
36 35
                     return 'Pending';
37 36
                 };
38 37
 
@@ -40,9 +39,9 @@  discard block
 block discarded – undo
40 39
             ->editColumn('is_email_sent', function ($data) {
41 40
                 if ($data->is_email_sent == 1) {
42 41
                     return "Success";
43
-                }elseif($data->is_email_sent == 2 ){
42
+                } elseif($data->is_email_sent == 2 ){
44 43
                     return 'Failed';
45
-                }else{
44
+                } else{
46 45
                     return 'Pending';
47 46
                 };
48 47
 
@@ -50,11 +49,11 @@  discard block
 block discarded – undo
50 49
             ->editColumn('update', function ($data) {
51 50
                 if ((int)$data->update  == 0) {
52 51
                     return "No Processes";
53
-                }elseif((int)$data->update == 1 ){
52
+                } elseif((int)$data->update == 1 ){
54 53
                     return 'Success';
55
-                }elseif((int)$data->update == 2 ){
54
+                } elseif((int)$data->update == 2 ){
56 55
                     return 'Failed';
57
-                }elseif((int)$data->update == 3 ){
56
+                } elseif((int)$data->update == 3 ){
58 57
                     return 'Partial Success';
59 58
                 };
60 59
 
@@ -62,11 +61,11 @@  discard block
 block discarded – undo
62 61
             ->editColumn('insert', function ($data) {
63 62
                 if ($data->insert == 0) {
64 63
                     return "No Processes";
65
-                }elseif($data->insert == 1 ){
64
+                } elseif($data->insert == 1 ){
66 65
                     return 'Success';
67
-                }elseif($data->insert == 2 ){
66
+                } elseif($data->insert == 2 ){
68 67
                     return 'Failed';
69
-                }elseif($data->insert == 3 ){
68
+                } elseif($data->insert == 3 ){
70 69
                     return 'Partial Success';
71 70
                 };
72 71
 
@@ -75,7 +74,7 @@  discard block
 block discarded – undo
75 74
                 if(\App::environment('local') || \App::environment('stage')){
76 75
                     return '<a href="/download_file/'.$data->filename.'">'.$data->classRoom->name.'</a>';
77 76
 
78
-                }else{
77
+                } else{
79 78
                     return '<a href="/bulk-upload/download_file/'.$data->filename.'">'.$data->classRoom->name.'</a>';
80 79
                 }
81 80
 
@@ -84,7 +83,7 @@  discard block
 block discarded – undo
84 83
                 if(\App::environment('local') || \App::environment('stage')){
85 84
                     return '<a href="/download/'.$data->filename.'">'.$data->classRoom->name.'</a>';
86 85
 
87
-                }else{
86
+                } else{
88 87
                     return '<a href="/bulk-upload/download/'.$data->filename.'">'.$data->classRoom->name.'</a>';
89 88
                 }
90 89
 
@@ -97,13 +96,13 @@  discard block
 block discarded – undo
97 96
 
98 97
                 if($diff_in_hours >= 2 && $data->is_processed == 3){
99 98
                     return '<button onclick="updateProcess('.($data->id).',100)" class="btn btn-primary text-uppercase">reprocess</button>';
100
-                }elseif ($data->is_processed == 1){
99
+                } elseif ($data->is_processed == 1){
101 100
                     return '<div><h6>Processing <span class="badge badge-success text-uppercase">Successful</span></h6></div>';
102
-                }elseif ($data->is_processed == 2){
101
+                } elseif ($data->is_processed == 2){
103 102
                     return '<div><h6>Processing <span class="badge badge-danger text-uppercase">Failed</span></h6></div>';
104
-                }elseif ($data->is_processed == 0){
103
+                } elseif ($data->is_processed == 0){
105 104
                     return '<button onclick="updateProcess('.($data->id).',200)" class="btn btn-block btn-warning text-uppercase">pause</button>';
106
-                }elseif ($data->is_processed == 4){
105
+                } elseif ($data->is_processed == 4){
107 106
                     return '<button onclick="updateProcess('.($data->id).',100)" class="btn btn-block btn-success text-uppercase">resume</button>';
108 107
                 }
109 108
             })
Please login to merge, or discard this patch.
app/Http/Controllers/BulkPromotion.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 
63 63
             if (!empty($isAvailableforPromotion)) {
64 64
                 $this->process($institutionGrade, $nextGrade, $year, 1);
65
-            } else {
65
+            }else {
66 66
                 $this->process($institutionGrade, $nextGrade, $year, 3);
67 67
             }
68 68
         }
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 
97 97
             $output = new \Symfony\Component\Console\Output\ConsoleOutput();
98 98
             $output->writeln('##########################################################################################################################');
99
-            $output->writeln('Promoting from ' . $institutionGrade['name'] . ' IN ' . $institution->name . ' No of Students: ' . count($studentListToPromote));
99
+            $output->writeln('Promoting from '.$institutionGrade['name'].' IN '.$institution->name.' No of Students: '.count($studentListToPromote));
100 100
 
101 101
 
102 102
             if (!empty($parallelClasses)) {
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
                 array_walk($studentListToPromote, array($this, 'assingeToClasses'), $params);
111 111
                 array_walk($parallelClasses, array($this, 'updateStudentCount'));
112 112
             }
113
-        } catch (\Exception $e) {
113
+        }catch (\Exception $e) {
114 114
             dd($e);
115 115
             Log::error($e->getMessage());
116 116
         }
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
         $nextAcademicPeriod = Academic_period::query()->where('code', $year)->get()->first();
146 146
 
147 147
         $nextGradeObj = null;
148
-        if ($nextGrade !== []  && !is_null($nextGrade)) {
148
+        if ($nextGrade !== [] && !is_null($nextGrade)) {
149 149
             $currentGradeObj = $this->instituion_grade->getParallelClasses($institutionGrade['id'], $institutionGrade['institution_id'], $institutionGrade['education_grade_id'], $academicPeriod->id);
150 150
             $nextGradeObj = $this->instituion_grade->getParallelClasses($institutionGrade['id'], $institutionGrade['institution_id'], $nextGrade->id, $nextAcademicPeriod->id);
151 151
         }
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
                 // promote parallel classes
156 156
                 $this->promotion($institutionGrade, $nextGrade, $academicPeriod, $nextAcademicPeriod, $nextGradeObj->toArray(), 1);
157 157
                 return 1;
158
-            } elseif (($nextGradeObj->count() > 1) && ($nextGradeObj->count() !==  $currentGradeObj->count())) {
158
+            } elseif (($nextGradeObj->count() > 1) && ($nextGradeObj->count() !== $currentGradeObj->count())) {
159 159
                 // promote pool promotion
160 160
                 $this->promotion($institutionGrade, $nextGrade, $academicPeriod, $nextAcademicPeriod, [], 1);
161 161
                 return 2;
@@ -163,12 +163,12 @@  discard block
 block discarded – undo
163 163
                 // Promote matching class name with previous class
164 164
                 $this->promotion($institutionGrade, $nextGrade, $academicPeriod, $nextAcademicPeriod, $nextGradeObj->toArray(), 1);
165 165
                 return 1;
166
-            } else {
166
+            }else {
167 167
                 // default pool promotion
168 168
                 $this->promotion($institutionGrade, $nextGrade, $academicPeriod, $nextAcademicPeriod, [], 1);
169 169
                 return 2;
170 170
             }
171
-        } else {
171
+        }else {
172 172
             // default pool promotion
173 173
             $this->promotion($institutionGrade, $nextGrade, $academicPeriod, $nextAcademicPeriod, [], 3);
174 174
             return 2;
@@ -204,10 +204,10 @@  discard block
 block discarded – undo
204 204
         ];
205 205
 
206 206
         try {
207
-            Institution_student::where('id', (string)$student['id'])->update($studentData);
207
+            Institution_student::where('id', (string) $student['id'])->update($studentData);
208 208
             $output = new \Symfony\Component\Console\Output\ConsoleOutput();
209
-            $output->writeln('----------------- ' . $student['admission_id'] . ' to ' . $studentData['education_grade_id']);
210
-        } catch (\Exception $e) {
209
+            $output->writeln('----------------- '.$student['admission_id'].' to '.$studentData['education_grade_id']);
210
+        }catch (\Exception $e) {
211 211
             dd($e);
212 212
             Log::error($e->getMessage());
213 213
         }
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
         $studentClass = $this->institution_class_students->getStudentNewClass($student);
229 229
         if (!is_null($studentClass)) {
230 230
             return  array_search(str_replace($educationGrade['name'], $nextGrade->name, $studentClass->name), array_column($classes, 'name'));
231
-        } else {
231
+        }else {
232 232
             return false;
233 233
         }
234 234
     }
@@ -280,11 +280,11 @@  discard block
 block discarded – undo
280 280
                 if (!$this->institution_class_students->isDuplicated($studentObj)) {
281 281
                     $this->institution_class_students->create($studentObj);
282 282
                     $output = new \Symfony\Component\Console\Output\ConsoleOutput();
283
-                    $output->writeln('----------------- ' . $student['student_id'] . 'to ' . $class['name']);
284
-                } else {
285
-                    $this->institution_class_students->where('id', (string)$student['id'])->update($studentObj);
283
+                    $output->writeln('----------------- '.$student['student_id'].'to '.$class['name']);
284
+                }else {
285
+                    $this->institution_class_students->where('id', (string) $student['id'])->update($studentObj);
286 286
                     $output = new \Symfony\Component\Console\Output\ConsoleOutput();
287
-                    $output->writeln('----------------- ' . $student['student_id'] . 'to ' . $class['name']);
287
+                    $output->writeln('----------------- '.$student['student_id'].'to '.$class['name']);
288 288
                 }
289 289
             }
290 290
         }
Please login to merge, or discard this patch.
app/Http/Controllers/DashboardViewsController.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
          * `select total from students_count_view  where institution_id = $id`
16 16
          * `select male from students_count_view  where institution_id = $id`
17 17
          * `select female from students_count_view  where institution_id = $id`
18
-        **/
18
+         **/
19 19
         DashboardViews::createOrUpdateStudentCount();
20 20
 
21 21
         /**
@@ -48,10 +48,10 @@  discard block
 block discarded – undo
48 48
          */
49 49
         DashboardViews::createOrUpdateStudentsCountByGrade();
50 50
 
51
-         /**
52
-         * Students count by BMI
53
-         * select * from students_count_by_bmi_view where institution_id = $id
54
-         */
51
+            /**
52
+             * Students count by BMI
53
+             * select * from students_count_by_bmi_view where institution_id = $id
54
+             */
55 55
         DashboardViews::createOrUpdateStudentCountByBMI();
56 56
 
57 57
         /**
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 class DashboardViewsController extends Controller
9 9
 {
10 10
     
11
-    public function callback(){
11
+    public function callback() {
12 12
         
13 13
         /** Total number of students by institutions
14 14
          *  In Grafana query to get total students count 
Please login to merge, or discard this patch.
app/Imports/ExaminationStudentsImport.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -18,9 +18,9 @@  discard block
 block discarded – undo
18 18
 use Maatwebsite\Excel\Concerns\WithBatchInserts;
19 19
 use Maatwebsite\Excel\Concerns\WithChunkReading;
20 20
 
21
-class ExaminationStudentsImport implements ToModel, WithStartRow, WithHeadingRow, WithChunkReading, WithBatchInserts , WithValidation ,WithMapping, SkipsOnFailure, SkipsOnError
21
+class ExaminationStudentsImport implements ToModel, WithStartRow, WithHeadingRow, WithChunkReading, WithBatchInserts, WithValidation, WithMapping, SkipsOnFailure, SkipsOnError
22 22
 {
23
-    use Importable , SkipsFailures, SkipsErrors;
23
+    use Importable, SkipsFailures, SkipsErrors;
24 24
 
25 25
     /**
26 26
      * @return int
@@ -57,14 +57,14 @@  discard block
 block discarded – undo
57 57
 
58 58
     private function transformDateTime(string $value, string $format = 'm/d/Y')
59 59
     {
60
-        try{
60
+        try {
61 61
             $date = date_create_from_format('m/d/Y', $value);
62
-            if(gettype($date)=='boolean'){
62
+            if (gettype($date) == 'boolean') {
63 63
                 $date = date_create_from_format('Y-m-d', $value);
64 64
             }
65 65
             $date = date_format($date, 'Y-m-d');
66 66
             return  $date;
67
-        }catch(\Exception $e){
67
+        }catch (\Exception $e) {
68 68
             $error = \Illuminate\Validation\ValidationException::withMessages([]);
69 69
             $failure = new Failure(2, 'remark', [0 => 'The given date is wrong']);
70 70
             $failures = [0 => $failure];
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@
 block discarded – undo
64 64
             }
65 65
             $date = date_format($date, 'Y-m-d');
66 66
             return  $date;
67
-        }catch(\Exception $e){
67
+        } catch(\Exception $e){
68 68
             $error = \Illuminate\Validation\ValidationException::withMessages([]);
69 69
             $failure = new Failure(2, 'remark', [0 => 'The given date is wrong']);
70 70
             $failures = [0 => $failure];
Please login to merge, or discard this patch.