@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | public function update(Contact $contact, Request $request) |
58 | 58 | { |
59 | 59 | // check if the user is allowed to edit the contact |
60 | - if (! backpack_user()->can('update', $contact)) { |
|
60 | + if (!backpack_user()->can('update', $contact)) { |
|
61 | 61 | abort(403); |
62 | 62 | } |
63 | 63 | |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | public function edit(Contact $contact) |
96 | 96 | { |
97 | 97 | // check if the user is allowed to edit the contact |
98 | - if (! backpack_user()->can('update', $contact)) { |
|
98 | + if (!backpack_user()->can('update', $contact)) { |
|
99 | 99 | abort(403); |
100 | 100 | } |
101 | 101 |
@@ -32,7 +32,7 @@ |
||
32 | 32 | $this->crud->allowAccess('showstudentphotoroster'); |
33 | 33 | $this->crud->setOperationSetting('setFromDb', true); |
34 | 34 | |
35 | - $this->crud->operation('showstudentphotoroster', function () { |
|
35 | + $this->crud->operation('showstudentphotoroster', function() { |
|
36 | 36 | $this->crud->loadDefaultOperationSettingsFromConfig(); |
37 | 37 | }); |
38 | 38 |
@@ -37,7 +37,7 @@ |
||
37 | 37 | } |
38 | 38 | |
39 | 39 | View::composer( |
40 | - ['partials.create_new_contact', 'students.edit-contact'], function ($view) { |
|
40 | + ['partials.create_new_contact', 'students.edit-contact'], function($view) { |
|
41 | 41 | $view->with('contact_types', ContactRelationship::all()); |
42 | 42 | }); |
43 | 43 | } |
@@ -72,25 +72,25 @@ discard block |
||
72 | 72 | ], |
73 | 73 | ]); |
74 | 74 | |
75 | - CRUD::addFilter([ // select2 filter |
|
75 | + CRUD::addFilter([// select2 filter |
|
76 | 76 | 'name' => 'teacher_id', |
77 | 77 | 'type' => 'select2', |
78 | 78 | 'label'=> __('Teacher'), |
79 | - ], function () { |
|
79 | + ], function() { |
|
80 | 80 | return Teacher::all()->pluck('name', 'id')->toArray(); |
81 | - }, function ($value) { // if the filter is active |
|
81 | + }, function($value) { // if the filter is active |
|
82 | 82 | CRUD::addClause('where', 'teacher_id', $value); |
83 | 83 | }, |
84 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
84 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
85 | 85 | }); |
86 | 86 | |
87 | - CRUD::addFilter([ // daterange filter |
|
87 | + CRUD::addFilter([// daterange filter |
|
88 | 88 | 'type' => 'date_range', |
89 | 89 | 'name' => 'from_to', |
90 | 90 | 'label'=> __('Date range'), |
91 | 91 | ], |
92 | 92 | false, |
93 | - function ($value) { // if the filter is active, apply these constraints |
|
93 | + function($value) { // if the filter is active, apply these constraints |
|
94 | 94 | $dates = json_decode($value); |
95 | 95 | CRUD::addClause('where', 'date', '>=', $dates->from); |
96 | 96 | CRUD::addClause('where', 'date', '<=', $dates->to.' 23:59:59'); |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | 'model' => LeaveType::class, // foreign key model |
123 | 123 | ], |
124 | 124 | |
125 | - [ // date_range |
|
125 | + [// date_range |
|
126 | 126 | 'name' => ['start_date', 'end_date'], // db columns for start_date & end_date |
127 | 127 | 'label' => 'Event Date Range', |
128 | 128 | 'type' => 'date_range', |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | 'model' => LeaveType::class, // foreign key model |
167 | 167 | ], |
168 | 168 | |
169 | - [ // datepicker |
|
169 | + [// datepicker |
|
170 | 170 | 'name' => 'date', |
171 | 171 | 'label' => 'Event Date', |
172 | 172 | 'type' => 'date', |
@@ -112,13 +112,13 @@ discard block |
||
112 | 112 | |
113 | 113 | ]); |
114 | 114 | |
115 | - CRUD::addFilter([ // daterange filter |
|
115 | + CRUD::addFilter([// daterange filter |
|
116 | 116 | 'type' => 'date_range', |
117 | 117 | 'name' => 'from_to', |
118 | 118 | 'label'=> __('Date range'), |
119 | 119 | ], |
120 | 120 | false, |
121 | - function ($value) { // if the filter is active, apply these constraints |
|
121 | + function($value) { // if the filter is active, apply these constraints |
|
122 | 122 | $dates = json_decode($value); |
123 | 123 | |
124 | 124 | if ($dates->from) { |
@@ -135,10 +135,10 @@ discard block |
||
135 | 135 | 'label'=> __('Events with no course'), |
136 | 136 | ], |
137 | 137 | false, |
138 | - function ($value) { // if the filter is active, apply these constraints |
|
138 | + function($value) { // if the filter is active, apply these constraints |
|
139 | 139 | $this->crud->query->where('course_id', null); |
140 | 140 | }, |
141 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
141 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
142 | 142 | }); |
143 | 143 | |
144 | 144 | CRUD::addFilter([ |
@@ -147,20 +147,20 @@ discard block |
||
147 | 147 | 'label'=> __('Events with no teacher'), |
148 | 148 | ], |
149 | 149 | false, |
150 | - function ($value) { // if the filter is active, apply these constraints |
|
150 | + function($value) { // if the filter is active, apply these constraints |
|
151 | 151 | $this->crud->query->where('teacher_id', null); |
152 | 152 | }); |
153 | 153 | |
154 | - CRUD::addFilter([ // select2 filter |
|
154 | + CRUD::addFilter([// select2 filter |
|
155 | 155 | 'name' => 'teacher_id', |
156 | 156 | 'type' => 'select2', |
157 | 157 | 'label'=> __('Teacher'), |
158 | - ], function () { |
|
158 | + ], function() { |
|
159 | 159 | return Teacher::all()->pluck('name', 'id')->toArray(); |
160 | - }, function ($value) { // if the filter is active |
|
160 | + }, function($value) { // if the filter is active |
|
161 | 161 | CRUD::addClause('where', 'teacher_id', $value); |
162 | 162 | }, |
163 | - function () { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
163 | + function() { // if the filter is NOT active (the GET parameter "checkbox" does not exit) |
|
164 | 164 | }); |
165 | 165 | } |
166 | 166 |
@@ -41,7 +41,7 @@ |
||
41 | 41 | |
42 | 42 | public function search() |
43 | 43 | { |
44 | - return QueryBuilder::for(Course::class)->where('campus_id', 1) |
|
44 | + return QueryBuilder::for (Course::class)->where('campus_id', 1) |
|
45 | 45 | ->with('room')->withCount('events')->withCount('children')->withCount('enrollments') |
46 | 46 | ->allowedFilters([ |
47 | 47 | 'name', |
@@ -69,7 +69,7 @@ |
||
69 | 69 | |
70 | 70 | $student_skills = $enrollment->skill_evaluations; |
71 | 71 | |
72 | - $skills = $course->skills->map(function ($skill, $key) use ($student_skills) { |
|
72 | + $skills = $course->skills->map(function($skill, $key) use ($student_skills) { |
|
73 | 73 | $skill['status'] = $student_skills->where('skill_id', $skill->id)->first()->skill_scale_id ?? null; |
74 | 74 | |
75 | 75 | return $skill; |
@@ -17,7 +17,7 @@ |
||
17 | 17 | private function setLocale(string $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 |
@@ -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 | } |