Passed
Push — master ( 154123...35918c )
by Thomas
05:57
created
app/Models/Enrollment.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
         parent::boot();
28 28
 
29 29
         // when creating a new enrollment, also add past attendance
30
-        static::created(function (self $enrollment) {
30
+        static::created(function(self $enrollment) {
31 31
             $events = $enrollment->course->events->where('start', '<', (new Carbon)->toDateString());
32 32
             foreach ($events as $event) {
33 33
                 $event->attendance()->create([
@@ -58,11 +58,11 @@  discard block
 block discarded – undo
58 58
     public function scopeWithoutChildren($query)
59 59
     {
60 60
         return $query
61
-            ->where(function ($query) {
61
+            ->where(function($query) {
62 62
                 $query->whereDoesntHave('childrenEnrollments')
63 63
                 ->where('parent_id', null);
64 64
             })
65
-            ->orWhere(function ($query) {
65
+            ->orWhere(function($query) {
66 66
                 $query->where('parent_id', null);
67 67
             })
68 68
             ->get();
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 
85 85
     public function scopePeriod(Builder $query, $period)
86 86
     {
87
-        return $query->whereHas('course', function ($q) use ($period) {
87
+        return $query->whereHas('course', function($q) use ($period) {
88 88
             $q->where('period_id', $period);
89 89
         });
90 90
     }
@@ -294,13 +294,13 @@  discard block
 block discarded – undo
294 294
 
295 295
         // delete attendance records related to the enrollment
296 296
         $attendances = $this->course->attendance->where('student_id', $this->student->id);
297
-        Attendance::destroy($attendances->map(function ($item, $key) {
297
+        Attendance::destroy($attendances->map(function($item, $key) {
298 298
             return $item->id;
299 299
         }));
300 300
 
301 301
         foreach ($this->course->children as $child) {
302 302
             $attendances = $child->attendance->where('student_id', $this->student->id);
303
-            Attendance::destroy($attendances->map(function ($item, $key) {
303
+            Attendance::destroy($attendances->map(function($item, $key) {
304 304
                 return $item->id;
305 305
             }));
306 306
         }
Please login to merge, or discard this patch.
app/Models/User.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
         parent::boot();
35 35
 
36 36
         // when deleting a user, also delete any teacher and students accounts associated to this user.
37
-        static::deleting(function (self $user) {
37
+        static::deleting(function(self $user) {
38 38
             if ($user->student()->exists()) {
39 39
                 Attendance::where('student_id', $user->student->id)->delete();
40 40
                 Enrollment::where('student_id', $user->student->id)->delete();
Please login to merge, or discard this patch.
app/Models/Event.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
         parent::boot();
18 18
 
19 19
         // before adding an event, we check that the teacher is available
20
-        static::saving(function ($event) {
20
+        static::saving(function($event) {
21 21
             $teacher = Teacher::find($event->teacher_id);
22 22
             // if the teacher is on leave on the day of the event
23 23
             if ($event->teacher_id !== null && $teacher->leaves->contains('date', Carbon::parse($event->start)->toDateString())) {
Please login to merge, or discard this patch.
app/Models/Course.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
      */
177 177
     public function getPendingAttendanceAttribute()
178 178
     {
179
-        $events = Event::where(function ($query) {
179
+        $events = Event::where(function($query) {
180 180
             $query->where('course_id', $this->id);
181 181
             $query->where('exempt_attendance', '!=', true);
182 182
             $query->where('exempt_attendance', '!=', 1);
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
             foreach ($courseTimes as $courseTime) {
248 248
                 $initial = $daysInitials[$courseTime->day];
249 249
 
250
-                if (! isset($parsedCourseTimes[$initial])) {
250
+                if (!isset($parsedCourseTimes[$initial])) {
251 251
                     $parsedCourseTimes[$initial] = [];
252 252
                 }
253 253
 
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 
323 323
     public function eventsWithExpectedAttendance()
324 324
     {
325
-        return $this->events()->where(function ($query) {
325
+        return $this->events()->where(function($query) {
326 326
             $query->where('exempt_attendance', '!=', true);
327 327
             $query->where('exempt_attendance', '!=', 1);
328 328
             $query->orWhereNull('exempt_attendance');
Please login to merge, or discard this patch.
app/Models/Teacher.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -186,15 +186,15 @@
 block discarded – undo
186 186
         $eventsWithMissingAttendance = [];
187 187
 
188 188
         $eventsWithExpectedAttendance = $this->events()
189
-        ->where(function ($query) {
189
+        ->where(function($query) {
190 190
             $query->where('exempt_attendance', '!=', true);
191 191
             $query->where('exempt_attendance', '!=', 1);
192 192
             $query->orWhereNull('exempt_attendance');
193 193
         })
194 194
         ->where('course_id', '!=', null)
195
-        ->whereHas('course', function (Builder $query) use ($period) {
195
+        ->whereHas('course', function(Builder $query) use ($period) {
196 196
             return $query->where('period_id', $period->id)
197
-                ->where(function ($query) {
197
+                ->where(function($query) {
198 198
                     $query->where('exempt_attendance', '!=', true);
199 199
                     $query->where('exempt_attendance', '!=', 1);
200 200
                     $query->orWhereNull('exempt_attendance');
Please login to merge, or discard this patch.
app/Models/Period.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -208,8 +208,8 @@
 block discarded – undo
208 208
                 foreach ($course->enrollments as $enrollment) {
209 209
                     // if a student has no attendance record for the class (event)
210 210
                     $hasNotAttended = $course->attendance->where('student_id', $enrollment->student_id)
211
-                     ->where('event_id', $event->id)
212
-                     ->isEmpty();
211
+                        ->where('event_id', $event->id)
212
+                        ->isEmpty();
213 213
 
214 214
                     // count one and break loop
215 215
                     if ($hasNotAttended) {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
     {
135 135
         $period = self::where('id', '<', $this->id)->orderBy('id', 'desc')->first();
136 136
 
137
-        if (! $period == null) {
137
+        if (!$period == null) {
138 138
             return $period;
139 139
         } else {
140 140
             return self::first();
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
     public function getCoursesWithPendingAttendanceAttribute()
196 196
     {
197 197
         // get all courses for period and preload relations
198
-        $courses = $this->courses()->where(function ($query) {
198
+        $courses = $this->courses()->where(function($query) {
199 199
             $query->where('exempt_attendance', '!=', true);
200 200
             $query->where('exempt_attendance', '!=', 1);
201 201
             $query->orWhereNull('exempt_attendance');
Please login to merge, or discard this patch.
app/Models/Leave.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,14 +20,14 @@
 block discarded – undo
20 20
         parent::boot();
21 21
 
22 22
         // do not save already existing leaves
23
-        static::saving(function (self $leave) {
23
+        static::saving(function(self $leave) {
24 24
             if (self::where('teacher_id', $leave->teacher_id)->where('date', $leave->date)->count() > 0) {
25 25
                 return false;
26 26
             }
27 27
         });
28 28
 
29 29
         // when a leave is, we detach the events from the teacher
30
-        static::saved(function (self $leave) {
30
+        static::saved(function(self $leave) {
31 31
             $events = Event::where('teacher_id', $leave->teacher_id)->whereDate('start', $leave->date)->get();
32 32
             foreach ($events as $event) {
33 33
                 $event->teacher_id = null;
Please login to merge, or discard this patch.
app/Models/Result.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
         parent::boot();
22 22
 
23 23
         // when a result is added, send a notification
24
-        static::saved(function (self $result) {
24
+        static::saved(function(self $result) {
25 25
             Mail::to($result->enrollment->student->user->email)
26 26
             ->locale($result->enrollment->student->locale)
27 27
             ->queue(new ResultNotification($result->enrollment->course, $result->enrollment->student->user));
Please login to merge, or discard this patch.
app/Models/CourseTime.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,12 +15,12 @@
 block discarded – undo
15 15
         parent::boot();
16 16
 
17 17
         // when a coursetime is added, we should create corresponding events
18
-        static::created(function ($coursetime) {
18
+        static::created(function($coursetime) {
19 19
             $coursetime->create_events();
20 20
         });
21 21
 
22 22
         // when a coursetime is deleted, we should delete all associated future events
23
-        static::deleted(function ($coursetime) {
23
+        static::deleted(function($coursetime) {
24 24
             $coursetime->events()->delete();
25 25
             // todo delete only future events
26 26
         });
Please login to merge, or discard this patch.