@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | parent::boot(); |
| 30 | 30 | |
| 31 | 31 | // when deleting a student, also delete any enrollments, grades and attendance related to this student |
| 32 | - static::deleting(function (self $student) { |
|
| 32 | + static::deleting(function(self $student) { |
|
| 33 | 33 | Attendance::where('student_id', $student->id)->delete(); |
| 34 | 34 | Enrollment::where('student_id', $student->id)->delete(); |
| 35 | 35 | }); |
@@ -66,8 +66,8 @@ discard block |
||
| 66 | 66 | |
| 67 | 67 | return $this->hasMany(Attendance::class) |
| 68 | 68 | ->where('attendance_type_id', 4) // absence |
| 69 | - ->whereHas('event', function ($q) use ($period) { |
|
| 70 | - return $q->whereHas('course', function ($c) use ($period) { |
|
| 69 | + ->whereHas('event', function($q) use ($period) { |
|
| 70 | + return $q->whereHas('course', function($c) use ($period) { |
|
| 71 | 71 | return $c->where('period_id', $period->id); |
| 72 | 72 | }); |
| 73 | 73 | }); |
@@ -80,8 +80,8 @@ discard block |
||
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | return $this->hasMany(Attendance::class) |
| 83 | - ->whereHas('event', function ($q) use ($period) { |
|
| 84 | - return $q->whereHas('course', function ($c) use ($period) { |
|
| 83 | + ->whereHas('event', function($q) use ($period) { |
|
| 84 | + return $q->whereHas('course', function($c) use ($period) { |
|
| 85 | 85 | return $c->where('period_id', $period->id); |
| 86 | 86 | }); |
| 87 | 87 | }); |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | public function getIsEnrolledAttribute() |
| 174 | 174 | { |
| 175 | 175 | // if the student is currently enrolled |
| 176 | - if ($this->enrollments()->whereHas('course', function ($q) { |
|
| 176 | + if ($this->enrollments()->whereHas('course', function($q) { |
|
| 177 | 177 | return $q->where('period_id', Period::get_default_period()->id); |
| 178 | 178 | })->count() > 0) { |
| 179 | 179 | return 1; |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | private function setLocale($locale) |
| 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 | |
@@ -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; |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | public function teacher(Request $request) |
| 50 | 50 | { |
| 51 | - if (! backpack_user()->isTeacher()) { |
|
| 51 | + if (!backpack_user()->isTeacher()) { |
|
| 52 | 52 | abort(403); |
| 53 | 53 | } |
| 54 | 54 | |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | |
| 68 | 68 | public function student() |
| 69 | 69 | { |
| 70 | - if (! backpack_user()->isStudent()) { |
|
| 70 | + if (!backpack_user()->isStudent()) { |
|
| 71 | 71 | abort(403); |
| 72 | 72 | } |
| 73 | 73 | |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | $currentPeriod = Period::get_default_period(); |
| 86 | 86 | $enrollmentsPeriod = Period::get_enrollments_period(); |
| 87 | 87 | |
| 88 | - if (! backpack_user()->hasRole(['admin', 'secretary'])) { |
|
| 88 | + if (!backpack_user()->hasRole(['admin', 'secretary'])) { |
|
| 89 | 89 | abort(403); |
| 90 | 90 | } |
| 91 | 91 | |
@@ -96,14 +96,14 @@ discard block |
||
| 96 | 96 | |
| 97 | 97 | $teachers = Teacher::with('user')->get()->toArray(); |
| 98 | 98 | |
| 99 | - $teachers = array_map(function ($teacher) { |
|
| 99 | + $teachers = array_map(function($teacher) { |
|
| 100 | 100 | return [ |
| 101 | 101 | 'id' => $teacher['id'], |
| 102 | 102 | 'title' => $teacher['user']['firstname'], |
| 103 | 103 | ]; |
| 104 | 104 | }, $teachers); |
| 105 | 105 | |
| 106 | - $events = array_map(function ($event) { |
|
| 106 | + $events = array_map(function($event) { |
|
| 107 | 107 | return [ |
| 108 | 108 | 'title' => $event['name'], |
| 109 | 109 | 'resourceId' => $event['teacher_id'], |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | 'currentPeriod' => $currentPeriod, |
| 122 | 122 | 'enrollmentsPeriod' => $enrollmentsPeriod, |
| 123 | 123 | 'total_enrollment_count' => $currentPeriod->internal_enrollments_count, |
| 124 | - 'pending_attendance' => $currentPeriod->courses_with_pending_attendance, // optimize |
|
| 124 | + 'pending_attendance' => $currentPeriod->courses_with_pending_attendance, // optimize |
|
| 125 | 125 | 'unassigned_events' => (new Event)->unassigned_teacher->count(), |
| 126 | 126 | 'upcoming_leaves' => Leave::upcoming_leaves(), |
| 127 | 127 | 'resources' => $teachers, |