@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | * a user is allowed to edit the course grades if they are the teacher for this course, |
| 31 | 31 | * or if they have explicit permission to do so |
| 32 | 32 | */ |
| 33 | - Gate::define('edit-course-grades', function ($user, $course) { |
|
| 33 | + Gate::define('edit-course-grades', function($user, $course) { |
|
| 34 | 34 | return $user->isTeacher() && $user->teacher_id == $course->teacher_id || $user->can('evaluation.edit'); |
| 35 | 35 | }); |
| 36 | 36 | |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | * a user is allowed to view the course attendance sheet if they are the teacher for this course, |
| 39 | 39 | * or if they have explicit permission to view all course attendance sheets |
| 40 | 40 | */ |
| 41 | - Gate::define('view-course-attendance', function ($user, $course) { |
|
| 41 | + Gate::define('view-course-attendance', function($user, $course) { |
|
| 42 | 42 | return $user->isTeacher() && $user->teacher_id == $course->teacher_id || $user->can('attendance.view'); |
| 43 | 43 | }); |
| 44 | 44 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | * if they are the teacher for this course, |
| 48 | 48 | * or if they have explicit permission to view all event attendance sheets |
| 49 | 49 | */ |
| 50 | - Gate::define('view-event-attendance', function ($user, $event) { |
|
| 50 | + Gate::define('view-event-attendance', function($user, $event) { |
|
| 51 | 51 | return ($event->teacher_id == $user->teacher_id) || ($event->course->teacher_id == $user->teacher_id) || $user->can('attendance.view'); |
| 52 | 52 | }); |
| 53 | 53 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | * if they are the teacher for the course, |
| 57 | 57 | * or if they have explicit permission to edit any attendance sheets |
| 58 | 58 | */ |
| 59 | - Gate::define('edit-attendance', function ($user, $event) { |
|
| 59 | + Gate::define('edit-attendance', function($user, $event) { |
|
| 60 | 60 | return ($event->teacher_id == $user->teacher_id) || ($event->course->teacher_id == $user->teacher_id) || $user->can('attendance.edit'); |
| 61 | 61 | }); |
| 62 | 62 | |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | * teachers are allowed to view their own calendar, |
| 65 | 65 | * and users with explicit permission can view all calendars |
| 66 | 66 | */ |
| 67 | - Gate::define('view-teacher-calendar', function ($user, $teacher) { |
|
| 67 | + Gate::define('view-teacher-calendar', function($user, $teacher) { |
|
| 68 | 68 | return ($user->isTeacher() && $user->teacher_id == $teacher->id) || $user->can('calendars.view'); |
| 69 | 69 | }); |
| 70 | 70 | |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | * teachers are allowed to view their own courses, |
| 73 | 73 | * and users with explicit permission can view all courses |
| 74 | 74 | */ |
| 75 | - Gate::define('view-course', function ($user, Course $course) { |
|
| 75 | + Gate::define('view-course', function($user, Course $course) { |
|
| 76 | 76 | return ($user->isTeacher() && $user->teacher_id == $course->teacher_id) || $user->can('courses.view'); |
| 77 | 77 | }); |
| 78 | 78 | |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | * if they are a teacher |
| 82 | 82 | * of if they have explicit permission to view any result |
| 83 | 83 | */ |
| 84 | - Gate::define('view-enrollment', function ($user, $enrollment) { |
|
| 84 | + Gate::define('view-enrollment', function($user, $enrollment) { |
|
| 85 | 85 | return ($user->isStudent() && $user->student_id == $enrollment->student_id) || $user->isTeacher() || $user->can('evaluation.view'); |
| 86 | 86 | }); |
| 87 | 87 | |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | * if the user is the teacher of the course |
| 90 | 90 | * of if they have explicit permission to enroll students |
| 91 | 91 | */ |
| 92 | - Gate::define('enroll-in-course', function ($user, $course) { |
|
| 92 | + Gate::define('enroll-in-course', function($user, $course) { |
|
| 93 | 93 | return $course->teacher_id == $user->teacher_id || $user->can('enrollments.edit'); |
| 94 | 94 | }); |
| 95 | 95 | |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | * if the user is a teacher |
| 98 | 98 | * of if they have explicit permission to enroll students |
| 99 | 99 | */ |
| 100 | - Gate::define('enroll-students', function ($user) { |
|
| 100 | + Gate::define('enroll-students', function($user) { |
|
| 101 | 101 | return $user->isTeacher() || $user->can('enrollments.edit'); |
| 102 | 102 | }); |
| 103 | 103 | |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | * teachers are allowed to view their own hours, |
| 106 | 106 | * and users with explicit permission can view all hours |
| 107 | 107 | */ |
| 108 | - Gate::define('view-teacher-hours', function ($user, $teacher) { |
|
| 108 | + Gate::define('view-teacher-hours', function($user, $teacher) { |
|
| 109 | 109 | return ($user->isTeacher() && $user->teacher_id == $teacher->id) || $user->can('hr.view'); |
| 110 | 110 | }); |
| 111 | 111 | |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | * teachers are allowed to edit results for their own students |
| 114 | 114 | * as well as users with explicit permission to edit any result |
| 115 | 115 | */ |
| 116 | - Gate::define('edit-result', function ($user, $enrollment) { |
|
| 116 | + Gate::define('edit-result', function($user, $enrollment) { |
|
| 117 | 117 | return ($user->isTeacher() && $user->teacher_id == $enrollment->course->teacher_id) || $user->can('evaluation.edit'); |
| 118 | 118 | }); |
| 119 | 119 | } |
@@ -228,8 +228,8 @@ |
||
| 228 | 228 | $user = Student::where('id', $this->guard()->user()->id)->first(); |
| 229 | 229 | |
| 230 | 230 | $user |
| 231 | - ->addMedia($request->fileToUpload) |
|
| 232 | - ->toMediaCollection('profile-picture'); |
|
| 231 | + ->addMedia($request->fileToUpload) |
|
| 232 | + ->toMediaCollection('profile-picture'); |
|
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | // if the user has been selected for a forced update, move to the next step |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | parent::boot(); |
| 19 | 19 | |
| 20 | 20 | // before adding an event, we check that the teacher is available |
| 21 | - static::saving(function ($event) { |
|
| 21 | + static::saving(function($event) { |
|
| 22 | 22 | $teacher = Teacher::find($event->teacher_id); |
| 23 | 23 | // if the teacher is on leave on the day of the event |
| 24 | 24 | if ($event->teacher_id !== null && $teacher) { |
@@ -23,7 +23,7 @@ |
||
| 23 | 23 | parent::boot(); |
| 24 | 24 | |
| 25 | 25 | // when an attendance record is added, we check if this is an absence |
| 26 | - static::saved(function (self $attendance) { |
|
| 26 | + static::saved(function(self $attendance) { |
|
| 27 | 27 | if ($attendance->attendance_type_id == 4) { // todo move to configurable settings |
| 28 | 28 | // Log::info('Absence marked for student '.$attendance->student->name); |
| 29 | 29 | // will check the record again and send a notification if it hasn't changed |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | */ |
| 310 | 310 | public function skills() |
| 311 | 311 | { |
| 312 | - return $this->evaluationType?->skills()->orderBy('order'); |
|
| 312 | + return $this->evaluationType ? ->skills()->orderBy('order'); |
|
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | public function books() |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | */ |
| 335 | 335 | public function getPendingAttendanceAttribute() |
| 336 | 336 | { |
| 337 | - $events = Event::where(function ($query) { |
|
| 337 | + $events = Event::where(function($query) { |
|
| 338 | 338 | $query->where('course_id', $this->id); |
| 339 | 339 | $query->where('exempt_attendance', '!=', true); |
| 340 | 340 | $query->where('exempt_attendance', '!=', 1); |
@@ -471,7 +471,7 @@ discard block |
||
| 471 | 471 | foreach ($courseTimes as $courseTime) { |
| 472 | 472 | $initial = $daysInitials[$courseTime->day]; |
| 473 | 473 | |
| 474 | - if (! isset($parsedCourseTimes[$initial])) { |
|
| 474 | + if (!isset($parsedCourseTimes[$initial])) { |
|
| 475 | 475 | $parsedCourseTimes[$initial] = []; |
| 476 | 476 | } |
| 477 | 477 | |
@@ -518,7 +518,7 @@ discard block |
||
| 518 | 518 | public function getCourseTeacherNameAttribute() |
| 519 | 519 | { |
| 520 | 520 | if ($this->teacher_id) { |
| 521 | - return $this->teacher?->name; |
|
| 521 | + return $this->teacher ? ->name; |
|
| 522 | 522 | } else { |
| 523 | 523 | return '-'; |
| 524 | 524 | } |
@@ -531,7 +531,7 @@ discard block |
||
| 531 | 531 | |
| 532 | 532 | public function getDescriptionAttribute() |
| 533 | 533 | { |
| 534 | - return '[' . $this->course_period_name . '] - ' . $this->name; |
|
| 534 | + return '['.$this->course_period_name.'] - '.$this->name; |
|
| 535 | 535 | } |
| 536 | 536 | |
| 537 | 537 | public function getChildrenCountAttribute() |
@@ -552,7 +552,7 @@ discard block |
||
| 552 | 552 | |
| 553 | 553 | public function getAcceptsNewStudentsAttribute(): bool |
| 554 | 554 | { |
| 555 | - if (! $this->spots || $this->spots == 0) { |
|
| 555 | + if (!$this->spots || $this->spots == 0) { |
|
| 556 | 556 | return true; |
| 557 | 557 | } |
| 558 | 558 | |
@@ -575,7 +575,7 @@ discard block |
||
| 575 | 575 | |
| 576 | 576 | public function eventsWithExpectedAttendance() |
| 577 | 577 | { |
| 578 | - return $this->events()->where(function ($query) { |
|
| 578 | + return $this->events()->where(function($query) { |
|
| 579 | 579 | $query->where('exempt_attendance', '!=', true); |
| 580 | 580 | $query->where('exempt_attendance', '!=', 1); |
| 581 | 581 | $query->orWhereNull('exempt_attendance'); |
@@ -604,10 +604,10 @@ discard block |
||
| 604 | 604 | { |
| 605 | 605 | if (config('app.currency_position') === 'before') |
| 606 | 606 | { |
| 607 | - return config('app.currency_symbol') . " ". $this->price; |
|
| 607 | + return config('app.currency_symbol')." ".$this->price; |
|
| 608 | 608 | } |
| 609 | 609 | |
| 610 | - return $this->price . " " . config('app.currency_symbol'); |
|
| 610 | + return $this->price." ".config('app.currency_symbol'); |
|
| 611 | 611 | } |
| 612 | 612 | |
| 613 | 613 | |
@@ -74,6 +74,6 @@ |
||
| 74 | 74 | |
| 75 | 75 | public function getCompleteNameAttribute() : string |
| 76 | 76 | { |
| 77 | - return '[' . ($this->level->name ?? '') . '] ' . ($this->skill_type->shortname ?? '') . ' - ' . $this->name ?? ''; |
|
| 77 | + return '['.($this->level->name ?? '').'] '.($this->skill_type->shortname ?? '').' - '.$this->name ?? ''; |
|
| 78 | 78 | } |
| 79 | 79 | } |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | { |
| 28 | 28 | // if the student is enrolled in any class by the user |
| 29 | 29 | |
| 30 | - return $student->enrollments()->whereHas('course', function ($q) use ($user) { |
|
| 30 | + return $student->enrollments()->whereHas('course', function($q) use ($user) { |
|
| 31 | 31 | return $q->where('teacher_id', $user->id); |
| 32 | 32 | })->count() > 0; |
| 33 | 33 | } |
@@ -73,10 +73,10 @@ |
||
| 73 | 73 | { |
| 74 | 74 | if (config('app.currency_position') === 'before') |
| 75 | 75 | { |
| 76 | - return config('app.currency_symbol') . " ". $this->price; |
|
| 76 | + return config('app.currency_symbol')." ".$this->price; |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - return $this->price . " " . config('app.currency_symbol'); |
|
| 79 | + return $this->price." ".config('app.currency_symbol'); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | public function getTypeAttribute() |
@@ -52,7 +52,7 @@ |
||
| 52 | 52 | public function getCompleteNameAttribute() |
| 53 | 53 | { |
| 54 | 54 | if ($this->category) { |
| 55 | - return '[' . $this->category->name . '] ' . $this->name; |
|
| 55 | + return '['.$this->category->name.'] '.$this->name; |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | return null; |