@@ -208,8 +208,8 @@ |
||
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) { |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | { |
76 | 76 | parent::boot(); |
77 | 77 | |
78 | - static::addGlobalScope('order', function (Builder $builder) { |
|
78 | + static::addGlobalScope('order', function(Builder $builder) { |
|
79 | 79 | $builder->orderBy('year_id')->orderBy('order')->orderBy('id'); |
80 | 80 | }); |
81 | 81 | } |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | { |
89 | 89 | $configPeriod = Config::where('name', 'current_period'); |
90 | 90 | |
91 | - if($configPeriod->exists()) { |
|
91 | + if ($configPeriod->exists()) { |
|
92 | 92 | $currentPeriod = $configPeriod->first()->value; |
93 | 93 | |
94 | 94 | if (self::where('id', $currentPeriod)->count() > 0) { |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | { |
225 | 225 | $period = self::where('id', '<', $this->id)->orderBy('id', 'desc')->first(); |
226 | 226 | |
227 | - if (! $period == null) { |
|
227 | + if (!$period == null) { |
|
228 | 228 | return $period; |
229 | 229 | } else { |
230 | 230 | return self::first(); |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | public function getCoursesWithPendingAttendanceAttribute() |
302 | 302 | { |
303 | 303 | // get all courses for period and preload relations |
304 | - $courses = $this->courses()->where(function ($query) { |
|
304 | + $courses = $this->courses()->where(function($query) { |
|
305 | 305 | $query->where('exempt_attendance', '!=', true); |
306 | 306 | $query->where('exempt_attendance', '!=', 1); |
307 | 307 | $query->orWhereNull('exempt_attendance'); |
@@ -20,14 +20,14 @@ |
||
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; |
@@ -15,12 +15,12 @@ |
||
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 | }); |
@@ -56,7 +56,7 @@ |
||
56 | 56 | return $this->respondToUnauthorizedRequest($request); |
57 | 57 | } |
58 | 58 | |
59 | - if (! $this->checkIfUserIsAdmin(backpack_user())) { |
|
59 | + if (!$this->checkIfUserIsAdmin(backpack_user())) { |
|
60 | 60 | return $this->respondToUnauthorizedRequest($request); |
61 | 61 | } |
62 | 62 |
@@ -19,7 +19,7 @@ |
||
19 | 19 | return redirect()->to('login'); |
20 | 20 | } |
21 | 21 | |
22 | - if (! backpack_user()->can($permission)) { |
|
22 | + if (!backpack_user()->can($permission)) { |
|
23 | 23 | abort(403); |
24 | 24 | } |
25 | 25 |
@@ -19,7 +19,7 @@ |
||
19 | 19 | return redirect('/login'); |
20 | 20 | } |
21 | 21 | |
22 | - if (! backpack_auth()->user()->hasRole($role)) { |
|
22 | + if (!backpack_auth()->user()->hasRole($role)) { |
|
23 | 23 | abort(403); |
24 | 24 | } |
25 | 25 |
@@ -14,7 +14,7 @@ |
||
14 | 14 | */ |
15 | 15 | protected function redirectTo($request) |
16 | 16 | { |
17 | - if (! $request->expectsJson()) { |
|
17 | + if (!$request->expectsJson()) { |
|
18 | 18 | return route('login'); |
19 | 19 | } |
20 | 20 | } |
@@ -17,7 +17,7 @@ |
||
17 | 17 | { |
18 | 18 | |
19 | 19 | // Check if is allowed and set default locale if not |
20 | - if (! language()->allowed($locale)) { |
|
20 | + if (!language()->allowed($locale)) { |
|
21 | 21 | $locale = config('app.locale'); |
22 | 22 | } |
23 | 23 |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | } |
115 | 115 | |
116 | 116 | // get past events for the course |
117 | - $events = $course->events->filter(function ($value, $key) { |
|
117 | + $events = $course->events->filter(function($value, $key) { |
|
118 | 118 | return Carbon::parse($value->start) < Carbon::now(); |
119 | 119 | })->sortByDesc('start'); |
120 | 120 | |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | |
200 | 200 | public function toggleEventAttendanceStatus(Event $event, Request $request) |
201 | 201 | { |
202 | - if (! backpack_user()->hasPermissionTo('courses.edit')) { |
|
202 | + if (!backpack_user()->hasPermissionTo('courses.edit')) { |
|
203 | 203 | abort(403); |
204 | 204 | } |
205 | 205 | $event->exempt_attendance = (int) $request->status; |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | |
211 | 211 | public function toggleCourseAttendanceStatus(Course $course, Request $request) |
212 | 212 | { |
213 | - if (! backpack_user()->hasPermissionTo('courses.edit')) { |
|
213 | + if (!backpack_user()->hasPermissionTo('courses.edit')) { |
|
214 | 214 | abort(403); |
215 | 215 | } |
216 | 216 | $course->exempt_attendance = (int) $request->status; |