Test Setup Failed
Pull Request — master (#266)
by Mohamed
07:49
created
app/Models/Institution_shift.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -41,20 +41,20 @@
 block discarded – undo
41 41
      */
42 42
     protected $dates = ['modified', 'created'];
43 43
 
44
-    public function shiftExists($shift){
44
+    public function shiftExists($shift) {
45 45
         return self::query()
46
-            ->where('institution_id',$shift['institution_id'])
47
-            ->where('location_institution_id',$shift['location_institution_id'])
48
-            ->where('shift_option_id',$shift['shift_option_id'])
49
-            ->where('academic_period_id',$shift['academic_period_id'])->exists();
46
+            ->where('institution_id', $shift['institution_id'])
47
+            ->where('location_institution_id', $shift['location_institution_id'])
48
+            ->where('shift_option_id', $shift['shift_option_id'])
49
+            ->where('academic_period_id', $shift['academic_period_id'])->exists();
50 50
     }
51 51
 
52
-    public function getShiftsToClone(int $year){
52
+    public function getShiftsToClone(int $year) {
53 53
         return self::query()
54 54
             ->select('institution_shifts.*')
55
-            ->join('academic_periods','academic_periods.id','=','institution_shifts.academic_period_id')
55
+            ->join('academic_periods', 'academic_periods.id', '=', 'institution_shifts.academic_period_id')
56 56
             // ->where('academic_periods.code',$year)
57
-            ->where('institution_shifts.cloned',$year)
57
+            ->where('institution_shifts.cloned', $year)
58 58
             ->get()->toArray();
59 59
     }
60 60
 }
Please login to merge, or discard this patch.
app/Models/User.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -69,32 +69,32 @@
 block discarded – undo
69 69
     protected $dates = ['email_verified_at'];
70 70
 
71 71
 
72
-    public function permissions(){
73
-        return $this->hasMany('App\Models\Security_group_user','security_user_id','id')
74
-                ->where('security_group_users.security_role_id','=',5)
75
-                ->with(['security_group_institution','institution_staff','security_group'  , 'staff_class','institution_group' , 'roles']);
72
+    public function permissions() {
73
+        return $this->hasMany('App\Models\Security_group_user', 'security_user_id', 'id')
74
+                ->where('security_group_users.security_role_id', '=', 5)
75
+                ->with(['security_group_institution', 'institution_staff', 'security_group', 'staff_class', 'institution_group', 'roles']);
76 76
     }
77 77
 
78
-    public function principal(){
79
-        return $this->hasMany('App\Models\Security_group_user','security_user_id','id')
80
-            ->where('security_group_users.security_role_id','=',4)
81
-            ->with(['security_group_institution','institution_staff','security_group'  , 'staff_class','institution_group' , 'roles']);
78
+    public function principal() {
79
+        return $this->hasMany('App\Models\Security_group_user', 'security_user_id', 'id')
80
+            ->where('security_group_users.security_role_id', '=', 4)
81
+            ->with(['security_group_institution', 'institution_staff', 'security_group', 'staff_class', 'institution_group', 'roles']);
82 82
     }
83 83
 
84
-    public function zonal_cordinator(){
85
-        return $this->hasMany('App\Models\Security_group_user','security_user_id','id')
86
-            ->where('security_group_users.security_role_id','=',3)
87
-            ->with(['security_group_institution','institution_staff','security_group'  , 'staff_class','institution_group' , 'roles']);
84
+    public function zonal_cordinator() {
85
+        return $this->hasMany('App\Models\Security_group_user', 'security_user_id', 'id')
86
+            ->where('security_group_users.security_role_id', '=', 3)
87
+            ->with(['security_group_institution', 'institution_staff', 'security_group', 'staff_class', 'institution_group', 'roles']);
88 88
     }
89 89
 
90 90
 
91
-    public function institution_class_teacher(){
92
-        return $this->hasMany('App\Models\Institution_staff','staff_id','id')
91
+    public function institution_class_teacher() {
92
+        return $this->hasMany('App\Models\Institution_staff', 'staff_id', 'id')
93 93
             ->with(['staff_class']);
94 94
     }
95 95
 
96
-    public function teacher_classes(){
97
-        return $this->hasMany('App\Models\Institution_class','staff_id','id');
96
+    public function teacher_classes() {
97
+        return $this->hasMany('App\Models\Institution_class', 'staff_id', 'id');
98 98
     }
99 99
 
100 100
     public function findForPassport($username) {
Please login to merge, or discard this patch.
app/Models/User_special_need.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -42,11 +42,11 @@
 block discarded – undo
42 42
     protected $dates = ['special_need_date', 'modified', 'created'];
43 43
     
44 44
     
45
-        public static function  isDuplicated($inputs){
45
+        public static function  isDuplicated($inputs) {
46 46
 
47
-        $exists = self::where('security_user_id','=',$inputs['security_user_id'])
48
-            ->where('special_need_type_id','=',$inputs['special_need_type_id'])
49
-            ->where('special_need_difficulty_id','=',$inputs['special_need_difficulty_id'])->count();
47
+        $exists = self::where('security_user_id', '=', $inputs['security_user_id'])
48
+            ->where('special_need_type_id', '=', $inputs['special_need_type_id'])
49
+            ->where('special_need_difficulty_id', '=', $inputs['special_need_difficulty_id'])->count();
50 50
 
51 51
 //       dd($exists);
52 52
         return $exists == 0 ? true :false;
Please login to merge, or discard this patch.
app/Models/Institution_grade.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -106,9 +106,9 @@
 block discarded – undo
106 106
      * @param $gradeId
107 107
      * @return mixed
108 108
      */
109
-    public function getInstitutionGrade($institutionId, $gradeId){
110
-            return self::where('education_grade_id',$gradeId)
111
-                ->where('institution_id',$institutionId)->get()->first();
109
+    public function getInstitutionGrade($institutionId, $gradeId) {
110
+            return self::where('education_grade_id', $gradeId)
111
+                ->where('institution_id', $institutionId)->get()->first();
112 112
     }
113 113
 
114 114
     /**
Please login to merge, or discard this patch.
app/Models/Institution.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
      */
42 42
     protected $dates = ['date_opened', 'date_closed', 'modified', 'created'];
43 43
 
44
-    public function isActive($id){
44
+    public function isActive($id) {
45 45
         return  self::query()->find($id)->get()->first()->institution_status_id == 1;
46 46
     }
47 47
 
Please login to merge, or discard this patch.
app/Http/Controllers/FileController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
             return Response::download($file_path, Auth::user()->openemis_no.'_'.$filename.$version, [
118 118
                 'Content-Length: '.filesize($file_path)
119 119
             ]);
120
-        } else
120
+        }else
121 121
         {
122 122
             return View::make('errors.404');
123 123
         }
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
             return Response::download($file_path, $filename, [
137 137
                 'Content-Length: '.filesize($file_path)
138 138
             ]);
139
-        } else
139
+        }else
140 140
         {
141 141
             abort(404, 'We did not found an error file.');
142 142
         }
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
             return Response::download($file_path, $filename, [
151 151
                 'Content-Length: '.filesize($file_path)
152 152
             ]);
153
-        } else
153
+        }else
154 154
         {
155 155
 
156 156
             abort(404, 'We did not found an error file.');
Please login to merge, or discard this patch.
app/Http/Controllers/FilesController.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -13,88 +13,88 @@
 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
                 } elseif ($data->is_processed === 1) {
27 27
                     return "Success";
28
-                } elseif ($data->is_processed === 2){
28
+                } elseif ($data->is_processed === 2) {
29 29
                     return "Failed";
30
-                } elseif($diff_in_hours < 2 && $data->is_processed == 3){
30
+                } elseif ($diff_in_hours < 2 && $data->is_processed == 3) {
31 31
                     return "Processing";
32
-                } elseif ($data->is_processed == 4){
32
+                } elseif ($data->is_processed == 4) {
33 33
                     return "Process Paused";
34
-                } else{
34
+                }else {
35 35
                     return 'Pending';
36 36
                 };
37 37
 
38 38
             })
39
-            ->editColumn('is_email_sent', function ($data) {
39
+            ->editColumn('is_email_sent', function($data) {
40 40
                 if ($data->is_email_sent === 1) {
41 41
                     return "Success";
42
-                } elseif($data->is_email_sent === 2 ){
42
+                } elseif ($data->is_email_sent === 2) {
43 43
                     return 'Failed';
44
-                } else{
44
+                }else {
45 45
                     return 'Pending';
46 46
                 };
47 47
 
48 48
             })
49
-            ->editColumn('update', function ($data) {
49
+            ->editColumn('update', function($data) {
50 50
                 if ($data->update === 0) {
51 51
                     return "No Processes";
52
-                } elseif($data->update === 1 ){
52
+                } elseif ($data->update === 1) {
53 53
                     return 'Success';
54
-                } elseif($data->update === 3 ){
54
+                } elseif ($data->update === 3) {
55 55
                     return 'Partial Success';
56
-                } else{
56
+                }else {
57 57
                     return 'Failed';
58 58
                 };
59 59
 
60 60
             })
61
-            ->editColumn('insert', function ($data) {
61
+            ->editColumn('insert', function($data) {
62 62
                 if ($data->insert === 0) {
63 63
                     return "No Processes";
64
-                } elseif($data->insert === 1 ){
64
+                } elseif ($data->insert === 1) {
65 65
                     return 'Success';
66
-                } elseif($data->insert === 3 ){
66
+                } elseif ($data->insert === 3) {
67 67
                     return 'Partial Success';
68
-                } else{
68
+                }else {
69 69
                     return 'Failed';
70 70
                 };
71 71
 
72 72
             })
73
-            ->editColumn('filename', function ($data) {
73
+            ->editColumn('filename', function($data) {
74 74
                 return '<a href='.env('APP_URL').'/download_file/'.$data->filename.'>'.substr($data->classRoom->name, 0, 10).'</a>';
75 75
             })
76
-                ->editColumn('error', function ($data) {
76
+                ->editColumn('error', function($data) {
77 77
                 return '<a href='.env('APP_URL').'/download/'.$data->filename.'>'.substr($data->classRoom->name, 0, 10).'</a>';
78
-            })->editColumn('actions', function ($data) {
78
+            })->editColumn('actions', function($data) {
79 79
 
80 80
                 $nowTime = \Carbon\Carbon::now();
81 81
                 $to = \Carbon\Carbon::createFromFormat('Y-m-d H:s:i', $nowTime);
82 82
                 $from = \Carbon\Carbon::createFromFormat('Y-m-d H:s:i', $data->updated_at);
83 83
                 $diff_in_hours = $to->diffInHours($from);
84 84
 
85
-                if($diff_in_hours >= 2 && $data->is_processed == 3){
85
+                if ($diff_in_hours >= 2 && $data->is_processed == 3) {
86 86
                     return '<button onclick="updateProcess('.($data->id).',100)" class="btn btn-primary text-uppercase">reprocess</button>';
87
-                } elseif ($data->is_processed == 1){
87
+                } elseif ($data->is_processed == 1) {
88 88
                     return '<div><h6>Processing <span class="badge badge-success text-uppercase">Successful</span></h6></div>';
89
-                } elseif ($data->is_processed == 2){
89
+                } elseif ($data->is_processed == 2) {
90 90
                     return '<div><h6>Processing <span class="badge badge-danger text-uppercase">Failed</span></h6></div>';
91
-                } elseif ($data->is_processed == 0){
91
+                } elseif ($data->is_processed == 0) {
92 92
                     return '<button onclick="updateProcess('.($data->id).',200)" class="btn btn-block btn-warning text-uppercase">pause</button>';
93
-                } elseif ($data->is_processed == 4){
93
+                } elseif ($data->is_processed == 4) {
94 94
                     return '<button onclick="updateProcess('.($data->id).',100)" class="btn btn-block btn-success text-uppercase">resume</button>';
95 95
                 }
96 96
             })
97
-            ->rawColumns(['filename','error','actions'])
97
+            ->rawColumns(['filename', 'error', 'actions'])
98 98
             ->make(true);
99 99
     }
100 100
 
Please login to merge, or discard this patch.
app/Imports/Import.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -193,12 +193,12 @@  discard block
 block discarded – undo
193 193
         return $row;
194 194
     }
195 195
 
196
-    protected function checkKeys($key,$count,$row){
197
-        if(array_key_exists($key,$row)){
196
+    protected function checkKeys($key, $count, $row) {
197
+        if (array_key_exists($key, $row)) {
198 198
             return true;
199
-        }else{
199
+        }else {
200 200
             $error = \Illuminate\Validation\ValidationException::withMessages([]);
201
-            $failure = new Failure($count, 'remark', [0 => 'Template is not valid for upload, use the template given in the system'. $key ,' Is missing form the template'], [null]);
201
+            $failure = new Failure($count, 'remark', [0 => 'Template is not valid for upload, use the template given in the system'.$key, ' Is missing form the template'], [null]);
202 202
             $failures = [0 => $failure];
203 203
             new \Maatwebsite\Excel\Validators\ValidationException($error, $failures);
204 204
         };
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
     public function map($row): array {
218 218
         try {
219 219
             $row = $this->mapFields($row);
220
-        } catch (\Maatwebsite\Excel\Validators\ValidationException $e) {
220
+        }catch (\Maatwebsite\Excel\Validators\ValidationException $e) {
221 221
                 $error = \Illuminate\Validation\ValidationException::withMessages([]);
222 222
                 $failure = new Failure(3, 'remark', [0 => 'Template is not valid for upload, use the template given in the system'], [null]);
223 223
                 $failures = [0 => $failure];
Please login to merge, or discard this patch.