Test Setup Failed
Pull Request — master (#486)
by Mohamed
07:25
created
app/Models/Institution_class_student.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
app/Models/Examination_student.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -52,9 +52,9 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
app/Http/Middleware/classTeacher.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -15,13 +15,13 @@
 block discarded – undo
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');
Please login to merge, or discard this patch.
app/Http/Controllers/ImportExport.php 1 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.
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 1 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.0_20200610.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/FilesController.php 1 patch
Spacing   +31 added lines, -31 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) {
50
+            ->editColumn('update', function($data) {
51 51
                 if ($data->update === 0) {
52 52
                     return "No Processes";
53
-                }elseif($data->update === 1 ){
53
+                }elseif ($data->update === 1) {
54 54
                     return 'Success';
55
-                }elseif($data->update === 3 ){
55
+                }elseif ($data->update === 3) {
56 56
                     return 'Partial Success';
57
-                }else{
57
+                }else {
58 58
                     return 'Failed';
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 === 3 ){
67
+                }elseif ($data->insert === 3) {
68 68
                     return 'Partial Success';
69
-                }else{
69
+                }else {
70 70
                     return 'Failed';
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.
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.