Test Setup Failed
Pull Request — master (#654)
by Mohamed
07:54
created
app/Models/Security_group.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 
5 5
 use Illuminate\Database\Eloquent\Model;
6 6
 
7
-class Security_group extends Model  {
7
+class Security_group extends Model {
8 8
 
9 9
     /**
10 10
      * The database table used by the model.
@@ -41,13 +41,13 @@  discard block
 block discarded – undo
41 41
      */
42 42
     protected $dates = ['modified', 'created', 'created', 'created', 'modified', 'created'];
43 43
 
44
-    public function security_users(){
45
-        return $this->belongsTo('App\Models\Security_group_user','security_group_id');
44
+    public function security_users() {
45
+        return $this->belongsTo('App\Models\Security_group_user', 'security_group_id');
46 46
     }
47 47
 
48 48
 
49
-    public function security_group_institution(){
50
-        return $this->hasMany('App\Models\Security_group_institution','security_group_id');
49
+    public function security_group_institution() {
50
+        return $this->hasMany('App\Models\Security_group_institution', 'security_group_id');
51 51
     }
52 52
 
53 53
 }
54 54
\ No newline at end of file
Please login to merge, or discard this patch.
app/Models/Institution_student.php 2 patches
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
     public static function boot()
72 72
     {
73 73
         parent::boot();
74
-        self::creating(function ($model) {
74
+        self::creating(function($model) {
75 75
             $model->id = (string) Uuid::generate(4);
76 76
             $model->created = now();
77 77
         });
@@ -129,9 +129,9 @@  discard block
 block discarded – undo
129 129
                 'institution_students.admission_id'
130 130
             )
131 131
             ->where('institution_students.institution_id', $institutionGrade['institution_id'])
132
-            ->where('institution_students.student_status_id',1)
132
+            ->where('institution_students.student_status_id', 1)
133 133
             ->where('institution_students.education_grade_id', $institutionGrade['education_grade_id'])
134
-            ->where('institution_students.deleted_at',null)
134
+            ->where('institution_students.deleted_at', null)
135 135
             ->where('institution_students.academic_period_id', $academicPeriod->id)->get()->toArray();
136 136
     }
137 137
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
      */
145 145
     public static function createExaminationData($student, $admissionInfo)
146 146
     {
147
-        $student['sp_center'] = gettype((int)$student['sp_center']) == 'integer' ?  $student['sp_center'] : 0;
147
+        $student['sp_center'] = gettype((int) $student['sp_center']) == 'integer' ? $student['sp_center'] : 0;
148 148
         try {
149 149
             self::create([
150 150
                 'id' => (string) Uuid::generate(4),
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
                 'created' => now(),
170 170
                 'created_user_id' => 1
171 171
             ]);
172
-        } catch (\Throwable $th) {
172
+        }catch (\Throwable $th) {
173 173
             Log::error($th);
174 174
         }
175 175
     }
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
      */
184 184
     public static function updateExaminationData($student, $admissionInfo)
185 185
     {
186
-        $student['sp_center'] = gettype((int)$student['sp_center']) == 'integer' ?  $student['sp_center'] : 0;
186
+        $student['sp_center'] = gettype((int) $student['sp_center']) == 'integer' ? $student['sp_center'] : 0;
187 187
         try {
188 188
             self::where([
189 189
                 'student_id' => $student['student_id'],
@@ -204,56 +204,56 @@  discard block
 block discarded – undo
204 204
                     'modified_user_id' => 1
205 205
                 ]
206 206
             );
207
-        } catch (\Throwable $th) {
207
+        }catch (\Throwable $th) {
208 208
             Log::error($th);
209 209
         }
210 210
     }
211 211
 
212
-    public static function updateStudentArea(array $student){
213
-        $father = Student_guardian::where('student_id',$student['student_id'])
214
-        ->join('security_users as sg','guardian_id', 'sg.id')
215
-        ->where('guardian_relation_id',1)
212
+    public static function updateStudentArea(array $student) {
213
+        $father = Student_guardian::where('student_id', $student['student_id'])
214
+        ->join('security_users as sg', 'guardian_id', 'sg.id')
215
+        ->where('guardian_relation_id', 1)
216 216
         ->get()->first();
217 217
 
218
-        $mother = Student_guardian::where('student_id',$student['student_id'])
219
-        ->join('security_users as sg','guardian_id', 'sg.id')
220
-        ->where('guardian_relation_id',2)
218
+        $mother = Student_guardian::where('student_id', $student['student_id'])
219
+        ->join('security_users as sg', 'guardian_id', 'sg.id')
220
+        ->where('guardian_relation_id', 2)
221 221
         ->get()->first();
222 222
 
223
-        $guardian = Student_guardian::where('student_id',$student['student_id'])
224
-        ->join('security_users as sg','guardian_id', 'sg.id')
225
-        ->where('guardian_relation_id',3)
223
+        $guardian = Student_guardian::where('student_id', $student['student_id'])
224
+        ->join('security_users as sg', 'guardian_id', 'sg.id')
225
+        ->where('guardian_relation_id', 3)
226 226
         ->get()->first();
227 227
     
228
-        if(!is_null($father) && is_null($mother) && is_null($guardian)){
229
-            Security_user::where('id',$student['student_id'])
228
+        if (!is_null($father) && is_null($mother) && is_null($guardian)) {
229
+            Security_user::where('id', $student['student_id'])
230 230
             ->update(['address_area_id' => $father->address_area_id]);
231
-        }elseif(!is_null($mother)  && (is_null($father) && is_null($guardian))){
232
-            Security_user::where('id',$student['student_id'])
231
+        }elseif (!is_null($mother) && (is_null($father) && is_null($guardian))) {
232
+            Security_user::where('id', $student['student_id'])
233 233
             ->update(['address_area_id' => $mother->address_area_id]);
234
-        }elseif(!is_null($guardian) && is_null($father) && is_null($mother)){
235
-            Security_user::where('id',$student['student_id'])
234
+        }elseif (!is_null($guardian) && is_null($father) && is_null($mother)) {
235
+            Security_user::where('id', $student['student_id'])
236 236
             ->update(['address_area_id' => $guardian->address_area_id]);
237
-        }elseif(!is_null($mother)  && !is_null($father) && ($father->address_area_id ==  $mother->address_area_id)){
237
+        }elseif (!is_null($mother) && !is_null($father) && ($father->address_area_id == $mother->address_area_id)) {
238 238
             // dd($father->address_area_id,$mother->address_area_id,$student['student_id']);
239
-            $d = Security_user::where('id',$student['student_id'])
239
+            $d = Security_user::where('id', $student['student_id'])
240 240
             ->update(['address_area_id' => $mother->address_area_id]);
241
-        }elseif(!is_null($mother)  && !is_null($father) && ($father->address_area_id !==  $mother->address_area_id) && !is_null($guardian)){
242
-            Security_user::where('id',$student['student_id'])
241
+        }elseif (!is_null($mother) && !is_null($father) && ($father->address_area_id !== $mother->address_area_id) && !is_null($guardian)) {
242
+            Security_user::where('id', $student['student_id'])
243 243
             ->update(['address_area_id' => $guardian->address_area_id]);
244
-        }elseif(!is_null($father) && $father->address == $student['address']){
245
-            Security_user::where('id',$student['student_id'])
244
+        }elseif (!is_null($father) && $father->address == $student['address']) {
245
+            Security_user::where('id', $student['student_id'])
246 246
             ->update(['address_area_id' => $guardian->address_area_id]);
247
-        }elseif(!is_null($mother) && $mother->address == $student['address']){
248
-            Security_user::where('id',$student['student_id'])
247
+        }elseif (!is_null($mother) && $mother->address == $student['address']) {
248
+            Security_user::where('id', $student['student_id'])
249 249
             ->update(['address_area_id' => $mother->address_area_id]);
250
-        }elseif(!is_null($guardian) && $guardian->address == $student['address']){
251
-            Security_user::where('id',$student['student_id'])
250
+        }elseif (!is_null($guardian) && $guardian->address == $student['address']) {
251
+            Security_user::where('id', $student['student_id'])
252 252
             ->update(['address_area_id' => $guardian->address_area_id]);
253 253
         }
254 254
     }
255 255
 
256
-    public static function createOrUpdate($studentId,$row,$params,$file){
256
+    public static function createOrUpdate($studentId, $row, $params, $file) {
257 257
         self::create([
258 258
             'student_status_id' => 1,
259 259
             'student_id' => $studentId,
Please login to merge, or discard this patch.
Braces   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -228,26 +228,26 @@
 block discarded – undo
228 228
         if(!is_null($father) && is_null($mother) && is_null($guardian)){
229 229
             Security_user::where('id',$student['student_id'])
230 230
             ->update(['address_area_id' => $father->address_area_id]);
231
-        }elseif(!is_null($mother)  && (is_null($father) && is_null($guardian))){
231
+        } elseif(!is_null($mother)  && (is_null($father) && is_null($guardian))){
232 232
             Security_user::where('id',$student['student_id'])
233 233
             ->update(['address_area_id' => $mother->address_area_id]);
234
-        }elseif(!is_null($guardian) && is_null($father) && is_null($mother)){
234
+        } elseif(!is_null($guardian) && is_null($father) && is_null($mother)){
235 235
             Security_user::where('id',$student['student_id'])
236 236
             ->update(['address_area_id' => $guardian->address_area_id]);
237
-        }elseif(!is_null($mother)  && !is_null($father) && ($father->address_area_id ==  $mother->address_area_id)){
237
+        } elseif(!is_null($mother)  && !is_null($father) && ($father->address_area_id ==  $mother->address_area_id)){
238 238
             // dd($father->address_area_id,$mother->address_area_id,$student['student_id']);
239 239
             $d = Security_user::where('id',$student['student_id'])
240 240
             ->update(['address_area_id' => $mother->address_area_id]);
241
-        }elseif(!is_null($mother)  && !is_null($father) && ($father->address_area_id !==  $mother->address_area_id) && !is_null($guardian)){
241
+        } elseif(!is_null($mother)  && !is_null($father) && ($father->address_area_id !==  $mother->address_area_id) && !is_null($guardian)){
242 242
             Security_user::where('id',$student['student_id'])
243 243
             ->update(['address_area_id' => $guardian->address_area_id]);
244
-        }elseif(!is_null($father) && $father->address == $student['address']){
244
+        } elseif(!is_null($father) && $father->address == $student['address']){
245 245
             Security_user::where('id',$student['student_id'])
246 246
             ->update(['address_area_id' => $guardian->address_area_id]);
247
-        }elseif(!is_null($mother) && $mother->address == $student['address']){
247
+        } elseif(!is_null($mother) && $mother->address == $student['address']){
248 248
             Security_user::where('id',$student['student_id'])
249 249
             ->update(['address_area_id' => $mother->address_area_id]);
250
-        }elseif(!is_null($guardian) && $guardian->address == $student['address']){
250
+        } elseif(!is_null($guardian) && $guardian->address == $student['address']){
251 251
             Security_user::where('id',$student['student_id'])
252 252
             ->update(['address_area_id' => $guardian->address_area_id]);
253 253
         }
Please login to merge, or discard this patch.
app/Models/Student_guardian.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 use Illuminate\Database\Eloquent\SoftDeletes;
8 8
 use Webpatser\Uuid\Uuid;
9 9
 
10
-class Student_guardian extends Base_Model  {
10
+class Student_guardian extends Base_Model {
11 11
 
12 12
     use SoftDeletes;
13 13
 
@@ -59,21 +59,21 @@  discard block
 block discarded – undo
59 59
     public static function boot()
60 60
     {
61 61
         parent::boot();
62
-        self::creating(function ($model) {
62
+        self::creating(function($model) {
63 63
             $model->id = (string) Uuid::generate(4);
64 64
             $model->created_user_id = 1;
65 65
         });
66 66
     }
67 67
 
68
-    public static function createStudentGuardian($student,$guardian,$user){
68
+    public static function createStudentGuardian($student, $guardian, $user) {
69 69
      
70 70
         $exist = true;
71
-        if(!is_null($guardian))
71
+        if (!is_null($guardian))
72 72
             $exist = self::where('student_id', $student->student_id)
73 73
             ->where('guardian_relation_id', $guardian->guardian_relation_id)
74 74
             ->exists();
75 75
 
76
-        $totalGuardians = self::where('student_id',$student->student_id)->count();
76
+        $totalGuardians = self::where('student_id', $student->student_id)->count();
77 77
 
78 78
         $data = [
79 79
             'student_id' => $student->student_id,
@@ -81,13 +81,13 @@  discard block
 block discarded – undo
81 81
             'guardian_relation_id' => $guardian->guardian_relation_id,
82 82
             'created_user_id' => $user
83 83
         ];
84
-        if(!$exist){
84
+        if (!$exist) {
85 85
             $data['created'] = now();
86 86
             self::create($data);
87
-        }else{
87
+        }else {
88 88
             $data['modified'] = now();
89
-            self::where('student_id' , $student->student_id)
90
-            ->where('guardian_relation_id',$guardian->guardian_relation_id)
89
+            self::where('student_id', $student->student_id)
90
+            ->where('guardian_relation_id', $guardian->guardian_relation_id)
91 91
             ->update($data);
92 92
         }
93 93
     }
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -68,10 +68,11 @@  discard block
 block discarded – undo
68 68
     public static function createStudentGuardian($student,$guardian,$user){
69 69
      
70 70
         $exist = true;
71
-        if(!is_null($guardian))
72
-            $exist = self::where('student_id', $student->student_id)
71
+        if(!is_null($guardian)) {
72
+                    $exist = self::where('student_id', $student->student_id)
73 73
             ->where('guardian_relation_id', $guardian->guardian_relation_id)
74 74
             ->exists();
75
+        }
75 76
 
76 77
         $totalGuardians = self::where('student_id',$student->student_id)->count();
77 78
 
@@ -84,7 +85,7 @@  discard block
 block discarded – undo
84 85
         if(!$exist){
85 86
             $data['created'] = now();
86 87
             self::create($data);
87
-        }else{
88
+        } else{
88 89
             $data['modified'] = now();
89 90
             self::where('student_id' , $student->student_id)
90 91
             ->where('guardian_relation_id',$guardian->guardian_relation_id)
Please login to merge, or discard this patch.
app/Models/User_body_mass.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 
5 5
 use Illuminate\Database\Eloquent\Model;
6 6
 
7
-class User_body_mass extends Base_Model  {
7
+class User_body_mass extends Base_Model {
8 8
 
9 9
     /**
10 10
      * The database table used by the model.
@@ -48,17 +48,17 @@  discard block
 block discarded – undo
48 48
     protected $dates = ['date', 'modified', 'created'];
49 49
 
50 50
 
51
-    public static function createOrUpdate($studentId,$row,$file){
51
+    public static function createOrUpdate($studentId, $row, $file) {
52 52
         if (!empty($row['bmi_weight']) && !empty($row['bmi_weight']) && !empty($row['bmi_date_yyyy_mm_dd'])) {
53 53
             try {
54 54
                 // convert Meeter to CM
55
-                $hight = $row['bmi_height'] / 100;
55
+                $hight = $row['bmi_height']/100;
56 56
                 //calculate BMI
57
-                $bodyMass = ($row['bmi_weight']) / pow($hight, 2);
57
+                $bodyMass = ($row['bmi_weight'])/pow($hight, 2);
58 58
                 $bmiAcademic = Academic_period::where('name', '=', $row['bmi_academic_period'])->first();
59 59
                 
60
-                $count = User_body_mass::where('academic_period_id' ,'=',$bmiAcademic->id)
61
-                            ->where('security_user_id',$studentId)->count();
60
+                $count = User_body_mass::where('academic_period_id', '=', $bmiAcademic->id)
61
+                            ->where('security_user_id', $studentId)->count();
62 62
                 $data = [
63 63
                     'height' => $row['bmi_height'],
64 64
                     'weight' => $row['bmi_weight'],
@@ -69,14 +69,14 @@  discard block
 block discarded – undo
69 69
                     'created_user_id' => $file['security_user_id']
70 70
                 ];
71 71
                 // dd($data);
72
-                if($count == 0){
72
+                if ($count == 0) {
73 73
                     self::create($data);
74
-                }else{
75
-                    self::where('security_user_id',$studentId)
74
+                }else {
75
+                    self::where('security_user_id', $studentId)
76 76
                     ->update($data);
77 77
                 }         
78
-            } catch (\Throwable $th) {
79
-                \Log::error('User_body_mass:' . $th->getMessage());
78
+            }catch (\Throwable $th) {
79
+                \Log::error('User_body_mass:'.$th->getMessage());
80 80
             }
81 81
         }
82 82
     }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@
 block discarded – undo
71 71
                 // dd($data);
72 72
                 if($count == 0){
73 73
                     self::create($data);
74
-                }else{
74
+                } else{
75 75
                     self::where('security_user_id',$studentId)
76 76
                     ->update($data);
77 77
                 }         
Please login to merge, or discard this patch.
app/Models/Institution_class_student.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -140,7 +140,7 @@
 block discarded – undo
140 140
     }
141 141
 
142 142
     public static function createOrUpdate($studentId,$params,$file){
143
-       return  self::create([
143
+        return  self::create([
144 144
             'student_id' => $studentId,
145 145
             'institution_class_id' => $params['institution_class']->id,
146 146
             'education_grade_id' => $params['institution_grade']->education_grade_id,
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
     public static function boot()
59 59
     {
60 60
         parent::boot();
61
-        self::creating(function ($model) {
61
+        self::creating(function($model) {
62 62
             $model->id = (string) Uuid::generate(4);
63 63
             $model->created = now();
64 64
         });
@@ -71,15 +71,15 @@  discard block
 block discarded – undo
71 71
 
72 72
     public  static function getStudentsCount($institution_class_id)
73 73
     {
74
-        $total_male_students = self::with(['student' => function ($query) {
74
+        $total_male_students = self::with(['student' => function($query) {
75 75
             $query->where('student.gender_id', '=', 1);
76
-        }])->whereHas('student', function ($query) {
76
+        }])->whereHas('student', function($query) {
77 77
             $query->where('gender_id', '=', 1);
78 78
         })->where('institution_class_id', '=', $institution_class_id)->count();
79 79
 
80
-        $total_female_students = self::with(['student' => function ($query) {
80
+        $total_female_students = self::with(['student' => function($query) {
81 81
             $query->where('student.gender_id', '=', 2);
82
-        }])->whereHas('student', function ($query) {
82
+        }])->whereHas('student', function($query) {
83 83
             $query->where('gender_id', '=', 2);
84 84
         })->where('institution_class_id', '=', $institution_class_id)->count();
85 85
 
@@ -109,8 +109,8 @@  discard block
 block discarded – undo
109 109
             ->where('student_id', $student['student_id'])
110 110
             ->join('institution_classes', 'institution_class_students.institution_class_id', '=', 'institution_classes.id')
111 111
             ->where('institution_class_students.student_id', $student['student_id'])
112
-            ->where('institution_class_students.academic_period_id',$student['academic_period_id'])
113
-            ->where('institution_class_students.institution_id',$student['institution_id'])
112
+            ->where('institution_class_students.academic_period_id', $student['academic_period_id'])
113
+            ->where('institution_class_students.institution_id', $student['institution_id'])
114 114
             ->whereNull('institution_class_students.deleted_at')
115 115
             ->get()->first();
116 116
     }
@@ -134,12 +134,12 @@  discard block
 block discarded – undo
134 134
                 'institution_id' => $admissionInfo['instituion']->id,
135 135
                 'student_status_id' => 1
136 136
             ]);
137
-        } catch (\Throwable $th) {
137
+        }catch (\Throwable $th) {
138 138
             Log::error($th);
139 139
         }
140 140
     }
141 141
 
142
-    public static function createOrUpdate($studentId,$params,$file){
142
+    public static function createOrUpdate($studentId, $params, $file) {
143 143
        return  self::create([
144 144
             'student_id' => $studentId,
145 145
             'institution_class_id' => $params['institution_class']->id,
Please login to merge, or discard this patch.