@@ -31,7 +31,7 @@ discard block |
||
| 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 | }); |
@@ -68,8 +68,8 @@ discard block |
||
| 68 | 68 | |
| 69 | 69 | return $this->hasMany(Attendance::class) |
| 70 | 70 | ->where('attendance_type_id', 4) // absence |
| 71 | - ->whereHas('event', function ($q) use ($period) { |
|
| 72 | - return $q->whereHas('course', function ($c) use ($period) { |
|
| 71 | + ->whereHas('event', function($q) use ($period) { |
|
| 72 | + return $q->whereHas('course', function($c) use ($period) { |
|
| 73 | 73 | return $c->where('period_id', $period->id); |
| 74 | 74 | }); |
| 75 | 75 | }); |
@@ -82,8 +82,8 @@ discard block |
||
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | return $this->hasMany(Attendance::class) |
| 85 | - ->whereHas('event', function ($q) use ($period) { |
|
| 86 | - return $q->whereHas('course', function ($c) use ($period) { |
|
| 85 | + ->whereHas('event', function($q) use ($period) { |
|
| 86 | + return $q->whereHas('course', function($c) use ($period) { |
|
| 87 | 87 | return $c->where('period_id', $period->id); |
| 88 | 88 | }); |
| 89 | 89 | }); |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | public function getIsEnrolledAttribute() |
| 176 | 176 | { |
| 177 | 177 | // if the student is currently enrolled |
| 178 | - if ($this->enrollments()->whereHas('course', function ($q) { |
|
| 178 | + if ($this->enrollments()->whereHas('course', function($q) { |
|
| 179 | 179 | return $q->where('period_id', $this->currentPeriod); |
| 180 | 180 | })->count() > 0) { |
| 181 | 181 | return 1; |