Passed
Push — master ( 99708e...74870e )
by Thomas
14:05
created
app/Providers/AuthServiceProvider.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -30,69 +30,69 @@
 block discarded – undo
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', fn ($user, $course) => $user->isTeacher() && $user->id == $course->teacher_id || $user->can('evaluation.edit'));
33
+        Gate::define('edit-course-grades', fn($user, $course) => $user->isTeacher() && $user->id == $course->teacher_id || $user->can('evaluation.edit'));
34 34
 
35 35
         /*
36 36
          * a user is allowed to view the course attendance sheet if they are the teacher for this course,
37 37
          * or if they have explicit permission to view all course attendance sheets
38 38
          */
39
-        Gate::define('view-course-attendance', fn ($user, $course) => $user->isTeacher() && $user->id == $course->teacher_id || $user->can('attendance.view'));
39
+        Gate::define('view-course-attendance', fn($user, $course) => $user->isTeacher() && $user->id == $course->teacher_id || $user->can('attendance.view'));
40 40
 
41 41
         /*
42 42
          * a user is allowed to view the event attendance sheet if they are the teacher for this event,
43 43
          * if they are the teacher for this course,
44 44
          * or if they have explicit permission to view all event attendance sheets
45 45
          */
46
-        Gate::define('view-event-attendance', fn ($user, $event) => ($event->teacher_id == $user->id) || ($event->course->teacher_id == $user->id) || $user->can('attendance.view'));
46
+        Gate::define('view-event-attendance', fn($user, $event) => ($event->teacher_id == $user->id) || ($event->course->teacher_id == $user->id) || $user->can('attendance.view'));
47 47
 
48 48
         /*
49 49
          * a user is allowed to edit an attendance sheet if they are the teacher for the event,
50 50
          * if they are the teacher for the course,
51 51
          * or if they have explicit permission to edit any attendance sheets
52 52
          */
53
-        Gate::define('edit-attendance', fn ($user, $event) => ($event->teacher_id == $user->id) || ($event->course->teacher_id == $user->id) || $user->can('attendance.edit'));
53
+        Gate::define('edit-attendance', fn($user, $event) => ($event->teacher_id == $user->id) || ($event->course->teacher_id == $user->id) || $user->can('attendance.edit'));
54 54
 
55 55
         /*
56 56
          * teachers are allowed to view their own calendar,
57 57
          * and users with explicit permission can view all calendars
58 58
          */
59
-        Gate::define('view-teacher-calendar', fn ($user, $teacher) => ($user->isTeacher() && $user->id == $teacher->id) || $user->can('calendars.view'));
59
+        Gate::define('view-teacher-calendar', fn($user, $teacher) => ($user->isTeacher() && $user->id == $teacher->id) || $user->can('calendars.view'));
60 60
 
61 61
         /*
62 62
          * teachers are allowed to view their own courses,
63 63
          * and users with explicit permission can view all courses
64 64
          */
65
-        Gate::define('view-course', fn ($user, Course $course) => ($user->isTeacher() && $user->id == $course->teacher_id) || $user->can('courses.view'));
65
+        Gate::define('view-course', fn($user, Course $course) => ($user->isTeacher() && $user->id == $course->teacher_id) || $user->can('courses.view'));
66 66
 
67 67
         /*
68 68
          * the user is allowed to view the result if they are the student,
69 69
          * if they are a teacher
70 70
          * of if they have explicit permission to view any result
71 71
          */
72
-        Gate::define('view-enrollment', fn ($user, $enrollment) => ($user->isStudent() && $user->id == $enrollment->student_id) || $user->isTeacher() || $user->can('evaluation.view'));
72
+        Gate::define('view-enrollment', fn($user, $enrollment) => ($user->isStudent() && $user->id == $enrollment->student_id) || $user->isTeacher() || $user->can('evaluation.view'));
73 73
 
74 74
         /*
75 75
          * if the user is the teacher of the course
76 76
          * of if they have explicit permission to enroll students
77 77
          */
78
-        Gate::define('enroll-in-course', fn ($user, $course) => $course->teacher_id == $user->id || $user->can('enrollments.edit'));
78
+        Gate::define('enroll-in-course', fn($user, $course) => $course->teacher_id == $user->id || $user->can('enrollments.edit'));
79 79
 
80 80
         /*
81 81
          * if the user is a teacher
82 82
          * of if they have explicit permission to enroll students
83 83
          */
84
-        Gate::define('enroll-students', fn ($user) => $user->isTeacher() || $user->can('enrollments.edit'));
84
+        Gate::define('enroll-students', fn($user) => $user->isTeacher() || $user->can('enrollments.edit'));
85 85
 
86 86
         /*
87 87
          * teachers are allowed to view their own hours,
88 88
          * and users with explicit permission can view all hours
89 89
          */
90
-        Gate::define('view-teacher-hours', fn ($user, $teacher) => ($user->isTeacher() && $user->id == $teacher->id) || $user->can('hr.view'));
90
+        Gate::define('view-teacher-hours', fn($user, $teacher) => ($user->isTeacher() && $user->id == $teacher->id) || $user->can('hr.view'));
91 91
 
92 92
         /*
93 93
          * teachers are allowed to edit results for their own students
94 94
          * as well as users with explicit permission to edit any result
95 95
          */
96
-        Gate::define('edit-result', fn ($user, $enrollment) => ($user->isTeacher() && $user->id == $enrollment->course->teacher_id) || $user->can('evaluation.edit'));
96
+        Gate::define('edit-result', fn($user, $enrollment) => ($user->isTeacher() && $user->id == $enrollment->course->teacher_id) || $user->can('evaluation.edit'));
97 97
     }
98 98
 }
Please login to merge, or discard this patch.
app/Http/Controllers/EnrollmentController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -172,7 +172,7 @@
 block discarded – undo
172 172
                         'price_b' => $enrollment->course->price_b,
173 173
                         'price_c' => $enrollment->course->price_c,
174 174
                     ]),
175
-                    'studentPriceCategory' => $enrollment->student?->price_category,
175
+                    'studentPriceCategory' => $enrollment->student ? ->price_category,
176 176
                 ]
177 177
             );
178 178
         }
Please login to merge, or discard this patch.
app/Http/Controllers/ScheduledPaymentController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -172,7 +172,7 @@
 block discarded – undo
172 172
                         'price_b' => $enrollment->course->price_b,
173 173
                         'price_c' => $enrollment->course->price_c,
174 174
                     ]),
175
-                    'studentPriceCategory' => $enrollment->student?->price_category,
175
+                    'studentPriceCategory' => $enrollment->student ? ->price_category,
176 176
                 ]
177 177
             );
178 178
         }
Please login to merge, or discard this patch.
app/Http/Controllers/TeacherCalendarController.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
         $events = Event::with('course')
26 26
             ->where('start', '>', Carbon::now()->subDays(30))->where('end', '<', Carbon::now()->addDays(30))->orderBy('id', 'desc') // TODO optimize this.
27 27
             ->get()
28
-            ->map(fn ($event) => [
28
+            ->map(fn($event) => [
29 29
                 'title' => $event->name ?? '',
30 30
                 'resourceId' => $event->teacher_id,
31 31
                 'start' => $event->start,
@@ -37,14 +37,14 @@  discard block
 block discarded – undo
37 37
 
38 38
         $teachers = Teacher::all()->toArray();
39 39
 
40
-        $teachers = array_map(fn ($teacher) => [
40
+        $teachers = array_map(fn($teacher) => [
41 41
             'id' => $teacher['id'],
42 42
             'title' => $teacher['name'] ?? '',
43 43
         ], $teachers);
44 44
 
45 45
         array_push($teachers, ['id' => 'tbd', 'title' => 'Unassigned']);
46 46
 
47
-        $unassigned_events = Event::unassigned()->get()->map(fn ($event) => [
47
+        $unassigned_events = Event::unassigned()->get()->map(fn($event) => [
48 48
             'title' => $event->name ?? '',
49 49
             'resourceId' => 'tbd',
50 50
             'start' => $event->start,
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
             'borderColor' => $event->color,
55 55
         ]);
56 56
 
57
-        $leaves = Leave::orderBy('date', 'desc')->limit(10000)->get()->map(fn ($event) => [
57
+        $leaves = Leave::orderBy('date', 'desc')->limit(10000)->get()->map(fn($event) => [
58 58
             'title' => $event->leaveType->name ?? 'ABS', // todo fix
59 59
             'resourceId' => $event['teacher_id'],
60 60
             'start' => $event['date'],
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
             abort(403);
81 81
         }
82 82
 
83
-        $events = $teacher->events->map(fn ($event) => [
83
+        $events = $teacher->events->map(fn($event) => [
84 84
             'title' => $event['name'],
85 85
             'start' => $event['start'],
86 86
             'end' => $event['end'],
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
             'borderColor' => $event['color'],
89 89
         ]);
90 90
 
91
-        $leaves = $teacher->leaves->map(fn ($event) => [
92
-            'title' => $event->leaveType->name ?? 'vacances',  // todo fix
91
+        $leaves = $teacher->leaves->map(fn($event) => [
92
+            'title' => $event->leaveType->name ?? 'vacances', // todo fix
93 93
             'start' => $event['date'],
94 94
             'allDay' => true,
95 95
         ]);
Please login to merge, or discard this patch.
app/Http/Controllers/RoomController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
             ->where('end', '<', Carbon::now()->addDays(90))
26 26
             ->orderBy('id', 'desc')
27 27
             ->get()
28
-            ->map(fn ($event) => [
28
+            ->map(fn($event) => [
29 29
                 'title' => $event->name,
30 30
                 'resourceId' => $event->room_id,
31 31
                 'start' => $event->start,
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 
38 38
         $rooms = Room::all()->toArray();
39 39
 
40
-        $rooms = array_map(fn ($room) => [
40
+        $rooms = array_map(fn($room) => [
41 41
             'id' => $room['id'],
42 42
             'title' => $room['name'],
43 43
         ], $rooms);
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
         $unassigned_events = Event::with('course')
48 48
             ->whereNull('room_id')
49 49
             ->get()
50
-            ->map(fn ($event) => [
50
+            ->map(fn($event) => [
51 51
                 'title' => $event->name,
52 52
                 'resourceId' => 'tbd',
53 53
                 'start' => $event->start,
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
     public function show(Room $room)
71 71
     {
72 72
         $events = $room->events->toArray();
73
-        $events = array_map(fn ($event) => [
73
+        $events = array_map(fn($event) => [
74 74
             'title' => $event['name'],
75 75
             'start' => $event['start'],
76 76
             'end' => $event['end'],
Please login to merge, or discard this patch.
app/Http/Controllers/Admin/UserCrudController.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
                 'label' => trans('backpack::permissionmanager.email'),
49 49
                 'type'  => 'email',
50 50
             ],
51
-            [ // n-n relationship (with pivot table)
51
+            [// n-n relationship (with pivot table)
52 52
                 'label'     => trans('backpack::permissionmanager.roles'),
53 53
                 'type'      => 'select_multiple',
54 54
                 'name'      => 'roles',
@@ -67,9 +67,9 @@  discard block
 block discarded – undo
67 67
                 'label' => trans('backpack::permissionmanager.role'),
68 68
             ],
69 69
             config('permission.models.role')::all()->pluck(['name', 'id'])->toArray(),
70
-            function ($value) {
70
+            function($value) {
71 71
                 // if the filter is active
72
-                $this->crud->addClause('whereHas', 'roles', function ($query) use ($value) {
72
+                $this->crud->addClause('whereHas', 'roles', function($query) use ($value) {
73 73
                     $query->where('role_id', '=', $value);
74 74
                 });
75 75
             }
@@ -120,12 +120,12 @@  discard block
 block discarded – undo
120 120
     protected function addFields()
121 121
     {
122 122
         $this->crud->addFields([
123
-            [  // Select2
123
+            [// Select2
124 124
                 'label' => trans('firstname'),
125 125
                 'type' => 'text',
126 126
                 'name' => 'firstname',
127 127
             ],
128
-            [  // Select2
128
+            [// Select2
129 129
                 'label' => trans('lastname'),
130 130
                 'type' => 'text',
131 131
                 'name' => 'lastname',
Please login to merge, or discard this patch.
app/Http/Controllers/Admin/SkillCrudController.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
     protected function setupListOperation()
32 32
     {
33 33
         CRUD::setColumns([
34
-            [ // skill type
34
+            [// skill type
35 35
                 'label'     => 'Type',
36 36
                 'type'      => 'select',
37 37
                 'name'      => 'skill_type',
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
                 'type' => 'text',
45 45
                 'name' => 'name',
46 46
             ],
47
-            [ // skill level
47
+            [// skill level
48 48
                 'label'     => 'Level',
49 49
                 'type'      => 'select',
50 50
                 'name'      => 'level',
@@ -56,19 +56,19 @@  discard block
 block discarded – undo
56 56
 
57 57
         CRUD::enableExportButtons();
58 58
 
59
-        CRUD::addFilter([ // select2 filter
59
+        CRUD::addFilter([// select2 filter
60 60
             'name' => 'level_id',
61 61
             'type' => 'select2',
62 62
             'label'=> 'Level',
63
-        ], fn () => Level::all()->pluck('name', 'id')->toArray(), function ($value) { // if the filter is active
63
+        ], fn() => Level::all()->pluck('name', 'id')->toArray(), function($value) { // if the filter is active
64 64
             CRUD::addClause('where', 'level_id', $value);
65 65
         });
66 66
 
67
-        CRUD::addFilter([ // select2 filter
67
+        CRUD::addFilter([// select2 filter
68 68
             'name' => 'skill_type_id',
69 69
             'type' => 'select2',
70 70
             'label'=> 'Type',
71
-        ], fn () => SkillType::all()->pluck('name', 'id')->toArray(), function ($value) { // if the filter is active
71
+        ], fn() => SkillType::all()->pluck('name', 'id')->toArray(), function($value) { // if the filter is active
72 72
             CRUD::addClause('where', 'skill_type_id', $value);
73 73
         });
74 74
     }
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
     {
78 78
         CRUD::setValidation(StoreRequest::class);
79 79
         CRUD::addFields([
80
-            [ // skill type
80
+            [// skill type
81 81
                 'label'     => 'Type',
82 82
                 'type' => 'select',
83 83
                 'name' => 'skill_type_id', // the db column for the foreign key
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
                 'type' => 'text',
91 91
                 'name' => 'name',
92 92
             ],
93
-            [ // skill level
93
+            [// skill level
94 94
                 'label'     => 'Level',
95 95
                 'type' => 'select',
96 96
                 'name' => 'level_id', // the db column for the foreign key
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
                 'type' => 'relationship',
104 104
                 'name' => 'skill_type', // the method on your model that defines the relationship
105 105
                 'ajax' => true,
106
-                'inline_create' => [ // specify the entity in singular
106
+                'inline_create' => [// specify the entity in singular
107 107
                     'entity' => 'skilltype', // the entity in singular
108 108
                     // OPTIONALS
109 109
                     'force_select' => true, // should the inline-created entry be immediately selected?
Please login to merge, or discard this patch.
app/Http/Controllers/Admin/TeacherCrudController.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -46,10 +46,10 @@  discard block
 block discarded – undo
46 46
                 'attribute' => 'lastname',
47 47
                 'model'     => \App\Models\User::class,
48 48
                 'orderable' => true,
49
-                'orderLogic' => fn ($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'students.id')
49
+                'orderLogic' => fn($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'students.id')
50 50
                     ->orderBy('users.lastname', $columnDirection)->select('students.*'),
51
-                'searchLogic' => function ($query, $column, $searchTerm) {
52
-                    $query->orWhereHas('user', function ($q) use ($searchTerm) {
51
+                'searchLogic' => function($query, $column, $searchTerm) {
52
+                    $query->orWhereHas('user', function($q) use ($searchTerm) {
53 53
                         $q->where('lastname', 'like', '%'.$searchTerm.'%');
54 54
                     });
55 55
                 },
@@ -64,10 +64,10 @@  discard block
 block discarded – undo
64 64
                 'attribute' => 'firstname',
65 65
                 'model'     => \App\Models\User::class,
66 66
                 'orderable' => true,
67
-                'orderLogic' => fn ($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'teachers.id')
67
+                'orderLogic' => fn($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'teachers.id')
68 68
                     ->orderBy('users.firstname', $columnDirection)->select('teachers.*'),
69
-                'searchLogic' => function ($query, $column, $searchTerm) {
70
-                    $query->orWhereHas('user', function ($q) use ($searchTerm) {
69
+                'searchLogic' => function($query, $column, $searchTerm) {
70
+                    $query->orWhereHas('user', function($q) use ($searchTerm) {
71 71
                         $q->where('firstname', 'like', '%'.$searchTerm.'%');
72 72
                     });
73 73
                 },
@@ -81,10 +81,10 @@  discard block
 block discarded – undo
81 81
                 'attribute' => 'email',
82 82
                 'model'     => \App\Models\User::class,
83 83
                 'orderable' => true,
84
-                'orderLogic' => fn ($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'teachers.id')
84
+                'orderLogic' => fn($query, $column, $columnDirection) => $query->leftJoin('users', 'users.id', '=', 'teachers.id')
85 85
                     ->orderBy('users.email', $columnDirection)->select('teachers.*'),
86
-                'searchLogic' => function ($query, $column, $searchTerm) {
87
-                    $query->orWhereHas('user', function ($q) use ($searchTerm) {
86
+                'searchLogic' => function($query, $column, $searchTerm) {
87
+                    $query->orWhereHas('user', function($q) use ($searchTerm) {
88 88
                         $q->where('email', 'like', '%'.$searchTerm.'%');
89 89
                     });
90 90
                 },
@@ -181,8 +181,8 @@  discard block
 block discarded – undo
181 181
         $username_parts = array_filter(explode(' ', strtolower($fullName)));
182 182
         $username_parts = array_slice($username_parts, -2);
183 183
 
184
-        $part1 = (! empty($username_parts[0])) ? substr($username_parts[0], 0, 3) : '';
185
-        $part2 = (! empty($username_parts[1])) ? substr($username_parts[1], 0, 8) : '';
184
+        $part1 = (!empty($username_parts[0])) ? substr($username_parts[0], 0, 3) : '';
185
+        $part2 = (!empty($username_parts[1])) ? substr($username_parts[1], 0, 8) : '';
186 186
         $part3 = random_int(999, 9999);
187 187
 
188 188
         $username = $part1.$part2.$part3; //str_shuffle to randomly shuffle all characters
Please login to merge, or discard this patch.
app/Http/Controllers/Admin/EvaluationTypeCrudController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     {
35 35
         CRUD::addField(['name' => 'name', 'label' => 'Name', 'type' => 'text']);
36 36
 
37
-        CRUD::addField([    // Select2Multiple = n-n relationship (with pivot table)
37
+        CRUD::addField([// Select2Multiple = n-n relationship (with pivot table)
38 38
             'label'     => __('Grade Types'),
39 39
             'type'      => 'select2_multiple',
40 40
             'name'      => 'gradeTypes',
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
             'select_all' => true, // show Select All and Clear buttons?
48 48
         ]);
49 49
 
50
-        CRUD::addField([    // Select2Multiple = n-n relationship (with pivot table)
50
+        CRUD::addField([// Select2Multiple = n-n relationship (with pivot table)
51 51
             'label'     => __('Skills'),
52 52
             'type'      => 'select2_multiple',
53 53
             'name'      => 'skills',
Please login to merge, or discard this patch.