Test Setup Failed
Push — master ( 93675a...ba3342 )
by Mohamed
14:07 queued 12s
created
app/Models/Institution_student.php 1 patch
Spacing   +3 added lines, -3 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
         });
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
                 'created' => now(),
155 155
                 'created_user_id' => 1
156 156
             ]);
157
-        } catch (\Throwable $th) {
157
+        }catch (\Throwable $th) {
158 158
             Log::error($th);
159 159
         }
160 160
     }
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
                     'modified_user_id' => 1
189 189
                 ]
190 190
             );
191
-        } catch (\Throwable $th) {
191
+        }catch (\Throwable $th) {
192 192
             Log::error($th);
193 193
         }
194 194
     }
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/ExaminationStudentsController.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
         $this->grade = $grade;
27 27
         $this->student = new Security_user();
28 28
         $this->examination_student = new Examination_student();
29
-        $this->academic_period =  Academic_period::where('code', '=', $this->year)->first();
29
+        $this->academic_period = Academic_period::where('code', '=', $this->year)->first();
30 30
         $this->education_grade = Education_grade::where('code', '=', $this->grade)->first();
31 31
         $this->output = new \Symfony\Component\Console\Output\ConsoleOutput();
32 32
     }
@@ -68,10 +68,10 @@  discard block
 block discarded – undo
68 68
                     );
69 69
                     Session::flash('message', 'File upload successfully!');
70 70
                     // Redirect to index
71
-                } else {
71
+                }else {
72 72
                     Session::flash('message', 'File too large. File must be less than 20MB.');
73 73
                 }
74
-            } else {
74
+            }else {
75 75
                 Session::flash('message', 'Invalid File Extension.');
76 76
             }
77 77
         }
@@ -110,11 +110,11 @@  discard block
 block discarded – undo
110 110
      * @param array $students
111 111
      * @return array
112 112
      */
113
-    public function setIsTakingExam($students){
113
+    public function setIsTakingExam($students) {
114 114
         $students['taking_g5_exam'] = false;
115 115
         $students['taking_ol_exam'] = false;
116 116
         $students['taking_al_exam'] = false;
117
-        switch($this->education_grade->code){
117
+        switch ($this->education_grade->code) {
118 118
             case 'G5':
119 119
                 $students['taking_g5_exam'] = true;
120 120
                 break;
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
             case 'G11':
128 128
                 $students['taking_ol_exam'] = true;
129 129
                 break;
130
-            case preg_match('13',$this->education_grade->code):  
130
+            case preg_match('13', $this->education_grade->code):  
131 131
                 $students['taking_al_exam'] = true;
132 132
                 break;             
133 133
         }
@@ -182,12 +182,12 @@  discard block
 block discarded – undo
182 182
                     Institution_student::createExaminationData($student, $admissionInfo);
183 183
                     Institution_student_admission::createExaminationData($student, $admissionInfo);
184 184
                     Institution_class_student::createExaminationData($student, $admissionInfo);
185
-                } else {
185
+                }else {
186 186
                     Institution_student_admission::createExaminationData($student, $admissionInfo);
187 187
                     Institution_student::createExaminationData($student, $admissionInfo);
188 188
                 }
189 189
                 // update the matched student's data    
190
-            } else {
190
+            }else {
191 191
                 $student = $this->student->updateExaminationStudent($student, $matchedStudent);
192 192
                 $matchedStudent = array_merge((array) $student, $matchedStudent);
193 193
                 Institution_student::updateExaminationData($matchedStudent, $admissionInfo);
@@ -238,21 +238,21 @@  discard block
 block discarded – undo
238 238
             }
239 239
 
240 240
             if (($previousValue)) {
241
-                $highest =  ($percentage > $previousValue['rate']) ? $value : $value;
242
-            } else {
241
+                $highest = ($percentage > $previousValue['rate']) ? $value : $value;
242
+            }else {
243 243
                 $highest = $value;
244 244
             }
245 245
             $previousValue = $value;
246 246
         }
247 247
 
248 248
         //If the not matched 100% try to get most highest value with full name
249
-        if ( ($highest['rate']  < 100) || (count($matchedData) > 1)) {
249
+        if (($highest['rate'] < 100) || (count($matchedData) > 1)) {
250 250
             foreach ($sis_students as $key => $value) {
251 251
                 similar_text($student['f_name'], $value['first_name'], $percentage);
252 252
                 $value['rate'] = $percentage;
253 253
                 if (($previousValue)) {
254
-                    $highest =  ($percentage > $previousValue['rate']) ? $value : $value;
255
-                } else {
254
+                    $highest = ($percentage > $previousValue['rate']) ? $value : $value;
255
+                }else {
256 256
                     $highest = $value;
257 257
                 }
258 258
                 $previousValue = $value;
@@ -270,10 +270,10 @@  discard block
 block discarded – undo
270 270
      */
271 271
     public function updateStudentId($student, $sis_student)
272 272
     {
273
-        $student['nsid'] =  $sis_student['openemis_no'];
273
+        $student['nsid'] = $sis_student['openemis_no'];
274 274
         // add new NSID to the examinations data set
275 275
         $this->examination_student->where(['st_no' => $student['st_no']])->update($student);
276
-        $this->output->writeln('Updated ' . $sis_student['id'] . ' to NSID' . $sis_student['openemis_no']);
276
+        $this->output->writeln('Updated '.$sis_student['id'].' to NSID'.$sis_student['openemis_no']);
277 277
     }
278 278
 
279 279
     /**
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/Http/Controllers/FilesController.php 1 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) {
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')  || \App::environment('prod')){
74
+            ->editColumn('filename', function($data) {
75
+                if (\App::environment('local') || \App::environment('stage') || \App::environment('prod')) {
76 76
                     return '<a href="/download_file/'.$data->filename.'">'.substr($data->filename, 0, 10).'</a>';
77 77
 
78
-                }else{
78
+                }else {
79 79
                     return '<a href="/bulk-upload/download_file/'.$data->filename.'">'.substr($data->filename, 0, 10).'</a>';
80 80
                 }
81 81
 
82 82
             })
83
-             ->editColumn('error', function ($data) {
84
-                if(\App::environment('local') || \App::environment('stage')  || \App::environment('prod')){
83
+             ->editColumn('error', function($data) {
84
+                if (\App::environment('local') || \App::environment('stage') || \App::environment('prod')) {
85 85
                     return '<a href="/download/'.$data->filename.'">'.substr($data->filename, 0, 10).'</a>';
86 86
 
87
-                }else{
88
-                    return '<a href="/bulk-upload/download/'.$data->filename.'">'.substr($data->filename, 0,10).'</a>';
87
+                }else {
88
+                    return '<a href="/bulk-upload/download/'.$data->filename.'">'.substr($data->filename, 0, 10).'</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.