Test Setup Failed
Pull Request — master (#261)
by Mohamed
07:57
created
app/Models/Area.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@
 block discarded – undo
4 4
 
5 5
 use Illuminate\Database\Eloquent\Model;
6 6
 
7
-class Area extends Model  {
7
+class Area extends Model {
8 8
 
9 9
     /**
10 10
      * The database table used by the model.
Please login to merge, or discard this patch.
app/Models/User_contact.php 2 patches
Spacing   +6 added lines, -6 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_contact extends Base_Model  {
7
+class User_contact extends Base_Model {
8 8
 
9 9
     /**
10 10
      * The database table used by the model.
@@ -41,14 +41,14 @@  discard block
 block discarded – undo
41 41
      */
42 42
     protected $dates = ['modified', 'created'];
43 43
 
44
-    public static function createOrUpdate($data,$user){
44
+    public static function createOrUpdate($data, $user) {
45 45
 
46
-        if(!is_null($data['contact'])){
46
+        if (!is_null($data['contact'])) {
47 47
             $exists = self::where('security_user_id', $data->id)
48
-                ->where('value',$data['contact']) 
48
+                ->where('value', $data['contact']) 
49 49
                 ->first(); 
50 50
 
51
-            if(is_null($exists)){
51
+            if (is_null($exists)) {
52 52
                 $data = [
53 53
                     'security_user_id' => $data->id,
54 54
                     'value' => $data['contact'],
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
                     'preferred' => 1
59 59
                 ];
60 60
                 self::updateOrCreate($data);
61
-            }else{
61
+            }else {
62 62
                 $exists = $exists->toArray();
63 63
                 $exists['preferred'] = 1;   
64 64
                 $exists['value'] = $data['contact'];
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@
 block discarded – undo
58 58
                     'preferred' => 1
59 59
                 ];
60 60
                 self::updateOrCreate($data);
61
-            }else{
61
+            } else{
62 62
                 $exists = $exists->toArray();
63 63
                 $exists['preferred'] = 1;   
64 64
                 $exists['value'] = $data['contact'];
Please login to merge, or discard this patch.
app/Models/Upload.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 Upload extends Model  {
7
+class Upload extends Model {
8 8
 
9 9
     /**
10 10
      * The database table used by the model.
@@ -43,12 +43,12 @@  discard block
 block discarded – undo
43 43
 
44 44
     public $timestamps = true;
45 45
 
46
-    public function user(){
47
-        return $this->belongsTo('App\Models\Security_user','security_user_id');
46
+    public function user() {
47
+        return $this->belongsTo('App\Models\Security_user', 'security_user_id');
48 48
     }
49 49
 
50
-    public function classRoom(){
51
-        return $this->belongsTo('App\Models\Institution_class','institution_class_id');
50
+    public function classRoom() {
51
+        return $this->belongsTo('App\Models\Institution_class', 'institution_class_id');
52 52
     }
53 53
 
54 54
 }
Please login to merge, or discard this patch.
app/Models/Academic_period.php 1 patch
Spacing   +3 added lines, -3 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 Academic_period extends Base_Model  {
7
+class Academic_period extends Base_Model {
8 8
 
9 9
     /**
10 10
      * The database table used by the model.
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
      */
42 42
     protected $dates = ['start_date', 'end_date', 'modified', 'created'];
43 43
 
44
-    public function getAcademicPeriod($year){
45
-        return self::query()->where('code',$year)->first();
44
+    public function getAcademicPeriod($year) {
45
+        return self::query()->where('code', $year)->first();
46 46
     }
47 47
 
48 48
 }
Please login to merge, or discard this patch.
app/Models/Identity_type.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@
 block discarded – undo
4 4
 
5 5
 use Illuminate\Database\Eloquent\Model;
6 6
 
7
-class Identity_type extends Model  {
7
+class Identity_type extends Model {
8 8
 
9 9
     /**
10 10
      * The database table used by the model.
Please login to merge, or discard this patch.
app/Models/Education_grade.php 1 patch
Spacing   +12 added lines, -12 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 Education_grade extends Model  {
7
+class Education_grade extends Model {
8 8
 
9 9
     /**
10 10
      * The database table used by the model.
@@ -41,17 +41,17 @@  discard block
 block discarded – undo
41 41
      */
42 42
     protected $dates = ['modified', 'created'];
43 43
 
44
-    public function getNextGrade($gradeId,$getNextProgrammeGrades = false, $firstGradeOnly = false){
44
+    public function getNextGrade($gradeId, $getNextProgrammeGrades = false, $firstGradeOnly = false) {
45 45
         if (!empty($gradeId)) {
46 46
             $gradeObj = $this->find($gradeId);
47 47
             $programmeId = $gradeObj->education_programme_id;
48 48
             $order = $gradeObj->order;
49
-            $gradeOptions = self::where( 'education_programme_id',$programmeId
50
-            )->where('order',$order+1)->get()->first();
49
+            $gradeOptions = self::where('education_programme_id', $programmeId
50
+            )->where('order', $order + 1)->get()->first();
51 51
             $nextProgramme = self::getNextProgrammeList($programmeId);
52
-            if(empty($gradeOptions) && !is_null($nextProgramme)){
52
+            if (empty($gradeOptions) && !is_null($nextProgramme)) {
53 53
                 $programmeId = $nextProgramme->next_programme_id;
54
-                $gradeOptions = self::where( 'education_programme_id',$programmeId
54
+                $gradeOptions = self::where('education_programme_id', $programmeId
55 55
                 )->get()->first();
56 56
             }
57 57
             // Default is to get the list of grades with the next programme grades
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 //                $results = $gradeOptions;
67 67
 //            }
68 68
             return $gradeOptions;
69
-        } else {
69
+        }else {
70 70
             return null;
71 71
         }
72 72
     }
@@ -78,11 +78,11 @@  discard block
 block discarded – undo
78 78
 
79 79
             foreach ($nextProgrammeList as $nextProgrammeId) {
80 80
                 $nextProgrammeGradeResults = self::
81
-                    where('education_programme_id',$nextProgrammeId->next_programme_id)->get()->toArray();
81
+                    where('education_programme_id', $nextProgrammeId->next_programme_id)->get()->toArray();
82 82
 
83 83
                 $results = $results + [key($nextProgrammeGradeResults) => current($nextProgrammeGradeResults)];
84 84
             }
85
-        } else {
85
+        }else {
86 86
             $results = [];
87 87
         }
88 88
 
@@ -100,9 +100,9 @@  discard block
 block discarded – undo
100 100
 
101 101
         $nextProgrammeList = $this->getNextProgrammeList($id);
102 102
         if (!empty($nextProgrammeList)) {
103
-            $results = self::whereIn('education_programme_id',$nextProgrammeList)
103
+            $results = self::whereIn('education_programme_id', $nextProgrammeList)
104 104
                 ->get()->toArray();
105
-        } else {
105
+        }else {
106 106
             $results = [];
107 107
         }
108 108
 
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
      * @return array List of next education programmes id
117 117
      */
118 118
     public function getNextProgrammeList($id) {
119
-        return Education_programmes_next_programme::where('education_programme_id',$id)
119
+        return Education_programmes_next_programme::where('education_programme_id', $id)
120 120
             ->get()->first();
121 121
     }
122 122
 
Please login to merge, or discard this patch.
app/Models/Base_Model.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 use Illuminate\Database\Eloquent\Model;
7 7
 use Illuminate\Support\Facades\Auth;
8 8
 
9
-class Base_Model extends Model{
9
+class Base_Model extends Model {
10 10
 
11 11
 
12 12
 
@@ -18,10 +18,10 @@  discard block
 block discarded – undo
18 18
     {
19 19
 
20 20
         parent::boot();
21
-        self::creating(function ($model) {
21
+        self::creating(function($model) {
22 22
             $model->created = Carbon::now();
23 23
         });
24
-        self::updating(function ($model) {
24
+        self::updating(function($model) {
25 25
             $model->modified = Carbon::now();
26 26
         });
27 27
     }
Please login to merge, or discard this patch.
app/Models/Institution_class_subject.php 2 patches
Spacing   +24 added lines, -24 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,11 +42,11 @@  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
         // ->using('App\Models\Institution_subject','institution_subjects.education_subject_id','education_grades_subjects.education_subject_id');
52 52
         // return $this->belongsToMany('App\Models\Education_grades_subject','institution_subjects','education_subject_id')
@@ -59,11 +59,11 @@  discard block
 block discarded – undo
59 59
             // });
60 60
     }
61 61
 
62
-    public function institutionOptionalSubject(){
63
-        return $this->belongsTo('App\Models\Institution_subject','institution_subject_id','id')
62
+    public function institutionOptionalSubject() {
63
+        return $this->belongsTo('App\Models\Institution_subject', 'institution_subject_id', 'id')
64 64
         ->with('institutionGradeSubject')
65
-        ->whereHas('institutionGradeSubject', function ($query) {
66
-                $query->where('auto_allocation',0);
65
+        ->whereHas('institutionGradeSubject', function($query) {
66
+                $query->where('auto_allocation', 0);
67 67
         });
68 68
 
69 69
     }
@@ -71,23 +71,23 @@  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
         });
77 77
     }
78 78
 
79
-    public function institutionSubject(){
80
-        return $this->belongsTo('App\Models\Institution_subject','institution_subject_id','id')
79
+    public function institutionSubject() {
80
+        return $this->belongsTo('App\Models\Institution_subject', 'institution_subject_id', 'id')
81 81
         ->with('institutionGradeSubject');
82 82
     }
83 83
 
84 84
 
85
-    public static function getMandetorySubjects($institutionClass){
85
+    public static function getMandetorySubjects($institutionClass) {
86 86
         $institutionGrade = Institution_class_grade::where('institution_class_id', '=', $institutionClass)->first();
87 87
         $mandatorySubject = Institution_class_subject::with(['institutionSubject'])
88
-            ->whereHas('institutionSubject', function ($query) use ($institutionGrade) {
89
-                $query->whereHas('institutionGradeSubject',function($query){
90
-                    $query->where('auto_allocation',1);
88
+            ->whereHas('institutionSubject', function($query) use ($institutionGrade) {
89
+                $query->whereHas('institutionGradeSubject', function($query) {
90
+                    $query->where('auto_allocation', 1);
91 91
                 })->where('education_grade_id', $institutionGrade->education_grade_id);
92 92
                 // ->where('auto_allocation', $institutionGrade->education_grade_id);
93 93
             })
@@ -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'])->exists();
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'])->exists();
128 128
     }
129 129
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -109,8 +109,9 @@
 block discarded – undo
109 109
                 })
110 110
                 ->where('institution_class_id', '=', $student->institution_class_id)
111 111
                 ->get()->toArray();
112
-            if (!empty($subjectId))
113
-                $data[] = $subjectId[0];
112
+            if (!empty($subjectId)) {
113
+                            $data[] = $subjectId[0];
114
+            }
114 115
         }
115 116
         return $data;
116 117
     }
Please login to merge, or discard this patch.
app/Models/Special_need_difficulty.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@
 block discarded – undo
4 4
 
5 5
 use Illuminate\Database\Eloquent\Model;
6 6
 
7
-class Special_need_difficulty extends Model  {
7
+class Special_need_difficulty extends Model {
8 8
 
9 9
     /**
10 10
      * The database table used by the model.
Please login to merge, or discard this patch.