Test Setup Failed
Pull Request — master (#654)
by Mohamed
07:54
created
app/Models/Institution_class_subject.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
 use Illuminate\Database\Eloquent\Model;
6 6
 use Webpatser\Uuid\Uuid;
7 7
 
8
-class Institution_class_subject extends Base_Model  {
8
+class Institution_class_subject extends Base_Model {
9 9
 
10 10
     /**
11 11
      * The database table used by the model.
@@ -42,19 +42,19 @@  discard block
 block discarded – undo
42 42
      */
43 43
     protected $dates = ['modified', 'created'];
44 44
 
45
-    public function institutionMandatorySubject(){
46
-        return $this->belongsTo('App\Models\Institution_subject','institution_subject_id','id')
45
+    public function institutionMandatorySubject() {
46
+        return $this->belongsTo('App\Models\Institution_subject', 'institution_subject_id', 'id')
47 47
         ->with('institutionGradeSubject')
48
-        ->whereHas('institutionGradeSubject', function ($query) {
49
-                $query->where('auto_allocation',1);
48
+        ->whereHas('institutionGradeSubject', function($query) {
49
+                $query->where('auto_allocation', 1);
50 50
         });
51 51
     }
52 52
 
53
-    public function institutionOptionalSubject(){
54
-        return $this->belongsTo('App\Models\Institution_subject','institution_subject_id','id')
53
+    public function institutionOptionalSubject() {
54
+        return $this->belongsTo('App\Models\Institution_subject', 'institution_subject_id', 'id')
55 55
         ->with('institutionGradeSubject')
56
-        ->whereHas('institutionGradeSubject', function ($query) {
57
-                $query->where('auto_allocation',0);
56
+        ->whereHas('institutionGradeSubject', function($query) {
57
+                $query->where('auto_allocation', 0);
58 58
         });
59 59
 
60 60
     }
@@ -62,23 +62,23 @@  discard block
 block discarded – undo
62 62
     public static function boot()
63 63
     {
64 64
         parent::boot();
65
-        self::creating(function ($model) {
65
+        self::creating(function($model) {
66 66
             $model->id = (string) Uuid::generate(4);
67 67
         });
68 68
     }
69 69
 
70
-    public function institutionSubject(){
71
-        return $this->belongsTo('App\Models\Institution_subject','institution_subject_id','id')
70
+    public function institutionSubject() {
71
+        return $this->belongsTo('App\Models\Institution_subject', 'institution_subject_id', 'id')
72 72
         ->with('institutionGradeSubject');
73 73
     }
74 74
 
75 75
 
76
-    public static function getMandatorySubjects($institutionClass){
76
+    public static function getMandatorySubjects($institutionClass) {
77 77
         $institutionGrade = Institution_class_grade::where('institution_class_id', '=', $institutionClass)->first();
78 78
         $mandatorySubject = Institution_class_subject::with(['institutionSubject'])
79
-            ->whereHas('institutionSubject', function ($query) use ($institutionGrade) {
80
-                $query->whereHas('institutionGradeSubject',function($query){
81
-                    $query->where('auto_allocation',1);
79
+            ->whereHas('institutionSubject', function($query) use ($institutionGrade) {
80
+                $query->whereHas('institutionGradeSubject', function($query) {
81
+                    $query->where('auto_allocation', 1);
82 82
                 })->where('education_grade_id', $institutionGrade->education_grade_id);
83 83
             })
84 84
             ->where('institution_class_id', '=', $institutionClass)
@@ -86,9 +86,9 @@  discard block
 block discarded – undo
86 86
         return $mandatorySubject;
87 87
     }
88 88
 
89
-    public static function getAllSubjects($institutionClass){
89
+    public static function getAllSubjects($institutionClass) {
90 90
         $allSubjects = Institution_class_subject::with(['institutionSubject'])
91
-        ->whereHas('institutionSubject', function ($query) use ($institutionClass) {
91
+        ->whereHas('institutionSubject', function($query) use ($institutionClass) {
92 92
             $query->whereHas('institutionGradeSubject')->where('education_grade_id', $institutionClass['education_grade_id']);
93 93
         })
94 94
         ->where('institution_class_id', '=', $institutionClass['id'])
@@ -100,9 +100,9 @@  discard block
 block discarded – undo
100 100
         $data = [];
101 101
         foreach ($subjects as $subject) {
102 102
             $subjectId = Institution_class_subject::with(['institutionSubject'])
103
-                ->whereHas('institutionSubject', function ($query) use ($row, $subject, $student) {
104
-                    $query->whereHas('institutionGradeSubject',function($query){
105
-                        $query->where('auto_allocation',0);
103
+                ->whereHas('institutionSubject', function($query) use ($row, $subject, $student) {
104
+                    $query->whereHas('institutionGradeSubject', function($query) {
105
+                        $query->where('auto_allocation', 0);
106 106
                     })
107 107
                         ->where('name', '=', $row[$subject])
108 108
                         ->where('education_grade_id', '=', $student->education_grade_id);
@@ -115,15 +115,15 @@  discard block
 block discarded – undo
115 115
         return $data;
116 116
     }
117 117
 
118
-    public function getInstitutionClassSubjects($academicPeriodId,$classIds){
118
+    public function getInstitutionClassSubjects($academicPeriodId, $classIds) {
119 119
         return self::query()
120
-            ->whereIn('institution_class_id',$classIds)
120
+            ->whereIn('institution_class_id', $classIds)
121 121
             ->get()
122 122
             ->toArray();
123 123
     }
124 124
 
125
-    public function isDuplicated($subject){
126
-        return self::query()->where('institution_subject_id',$subject['institution_subject_id'])
127
-            ->where('institution_class_id',$subject['institution_class_id'])->get()->toArray();
125
+    public function isDuplicated($subject) {
126
+        return self::query()->where('institution_subject_id', $subject['institution_subject_id'])
127
+            ->where('institution_class_id', $subject['institution_class_id'])->get()->toArray();
128 128
     }
129 129
 }
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.