Passed
Push — master ( 1a4135...4c3117 )
by Thomas
16:03 queued 07:54
created
app/Models/Student.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
         parent::boot();
32 32
 
33 33
         // when deleting a student, also delete any enrollments, grades and attendance related to this student
34
-        static::deleting(function (self $student) {
34
+        static::deleting(function(self $student) {
35 35
             Attendance::where('student_id', $student->id)->delete();
36 36
             Enrollment::where('student_id', $student->id)->delete();
37 37
         });
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
     {
42 42
         switch ($leadTypeId) {
43 43
             case 1: // active / enrolled students
44
-                return $query->whereHas('enrollments', function ($query) {
45
-                    return $query->whereHas('course', function ($q) {
44
+                return $query->whereHas('enrollments', function($query) {
45
+                    return $query->whereHas('course', function($q) {
46 46
                         $q->where('period_id', Period::get_default_period()->id);
47 47
                     });
48 48
                 });
@@ -56,18 +56,18 @@  discard block
 block discarded – undo
56 56
             case 4: // old students who have at least one enrollment
57 57
                 return $query
58 58
                     ->where('lead_type_id', $leadTypeId)
59
-                    ->orWhere(function ($query) {
59
+                    ->orWhere(function($query) {
60 60
                         $query
61 61
                             ->whereNull('lead_type_id')
62
-                            ->whereHas('enrollments', function ($query) {
62
+                            ->whereHas('enrollments', function($query) {
63 63
                                 return $query
64
-                                    ->whereHas('course', function ($q) {
64
+                                    ->whereHas('course', function($q) {
65 65
                                         $q->where('period_id', '!=', Period::get_default_period()->id);
66 66
                                     });
67 67
                             })
68
-                            ->whereDoesntHave('enrollments', function ($query) {
68
+                            ->whereDoesntHave('enrollments', function($query) {
69 69
                                 return $query
70
-                                    ->whereHas('course', function ($q) {
70
+                                    ->whereHas('course', function($q) {
71 71
                                         $q->where('period_id', Period::get_default_period()->id);
72 72
                                     });
73 73
                             });
@@ -104,8 +104,8 @@  discard block
 block discarded – undo
104 104
 
105 105
         return $this->hasMany(Attendance::class)
106 106
         ->where('attendance_type_id', 4) // absence
107
-        ->whereHas('event', function ($q) use ($period) {
108
-            return $q->whereHas('course', function ($c) use ($period) {
107
+        ->whereHas('event', function($q) use ($period) {
108
+            return $q->whereHas('course', function($c) use ($period) {
109 109
                 return $c->where('period_id', $period->id);
110 110
             });
111 111
         });
@@ -118,8 +118,8 @@  discard block
 block discarded – undo
118 118
         }
119 119
 
120 120
         return $this->hasMany(Attendance::class)
121
-        ->whereHas('event', function ($q) use ($period) {
122
-            return $q->whereHas('course', function ($c) use ($period) {
121
+        ->whereHas('event', function($q) use ($period) {
122
+            return $q->whereHas('course', function($c) use ($period) {
123 123
                 return $c->where('period_id', $period->id);
124 124
             });
125 125
         });
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
     public function getIsEnrolledAttribute()
212 212
     {
213 213
         // if the student is currently enrolled
214
-        if ($this->enrollments()->whereHas('course', function ($q) {
214
+        if ($this->enrollments()->whereHas('course', function($q) {
215 215
             return $q->where('period_id', Period::get_default_period()->id);
216 216
         })->count() > 0) {
217 217
             return 1;
Please login to merge, or discard this patch.